Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'<img />' elements have 'href' field in some browsers #15

Open
xsc opened this issue Apr 21, 2016 · 3 comments
Open

'<img />' elements have 'href' field in some browsers #15

xsc opened this issue Apr 21, 2016 · 3 comments

Comments

@xsc
Copy link

xsc commented Apr 21, 2016

It seems that in some browsers (IE10/IE11 is where I saw it), <img /> DOM elements have an href which represents the path portion of the src URI, e.g.:

<img id='test' src='http://somewhere.de/image.png' />
document.getElementById('test').href
// => '/image.png'

Now, when pushy checks for (.-href target) (and only afterwards recurses through target's parents), it might pick up the image tag instead of the anchor in the following example:

<a href='/valid.png'>
  <img src='/invalid.png' />
</a>

Note that, while href is present in both IE10's and IE11's image elements, I can only observe the problematic behaviour in IE10 (and even then only on some machines, so there might exist some patched versions - or another factor I haven't discovered yet).

But, generally speaking, would it make sense to you to exclude image tags when checking for href? I'd be happy to supply a PR if desired.

Have a nice day!
Yannick

@AlexWheeler
Copy link
Contributor

I'm curious in general why is the event handler registered on document, which then traverses up to find href, and not just registered on every anchor tag?

@wavejumper
Copy link
Member

@AlexWheeler @xsc see #27

@xsc
Copy link
Author

xsc commented Aug 29, 2017

@wavejumper Just out of curiosity (since I'm no longer on the project that was using pushy), are there any plans to fix those issues?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants