Bug Tracker

Modify

Ticket #10976 (closed bug: cantfix)

Opened 19 months ago

Last modified 19 months ago

ie7/8 seem to have problems with a[href="#"]

Reported by: jacob@… Owned by:
Priority: low Milestone: None
Component: core Version: 1.7.1
Keywords: Cc:
Blocking: Blocked by:

Description

Here's a test case  http://jsbin.com/efalod/3

Seems to only be a problem with adding the element dynamically.

thanks!

Change History

comment:1 Changed 19 months ago by anonymous

 http://jsbin.com/efalod/7/edit#javascript,html

also doesn't appear to work for a regular selector

comment:2 Changed 19 months ago by rwaldron

  • Priority changed from undecided to high
  • Status changed from new to open
  • Component changed from unfiled to event

comment:3 Changed 19 months ago by dmethvin

  • Priority changed from high to low
  • Resolution set to cantfix
  • Status changed from open to closed
  • Component changed from event to core

It's a problem with .is(), which is used by the event delegation:

alert($("a").is('a[href="#"]'));  // false

And it's because of the old problem with IE6/7 creating a full URL for an href:

alert($("a").attr('href'));  // "http://fiddle.jshell.net/_display/#"

When we use .innerHTML to create an element (as is being done here when you specify a string) it will munge the href before we can do anything about it. If this is in the actual HTML markup we are able to use the .getAttribute("href", 2) hack to get the real unmunged href but that's not an option here.

Workaround 1: Use $=:  http://jsfiddle.net/7zQDR/2/

Workaround 2: Use explicit .attr():  http://jsfiddle.net/7zQDR/4/

comment:4 Changed 19 months ago by timmywil

that's exactly right. Also see #10745

comment:5 Changed 19 months ago by anonymous

Thank's for the "$=" workaround - great idea

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.