Bug Tracker

Opened 5 years ago

Closed 5 years ago

Last modified 4 years ago

#12531 closed bug (duplicate)

elem[attr] selector

Reported by: phantick@… Owned by: Rick Waldron
Priority: high Milestone: None
Component: core Version: 1.7.1
Keywords: Cc:
Blocked by: Blocking:

Description

Hi.

jQuery JavaScript Library v1.7.1

I have element

<tr target="contacts" key="<1291012254.6.phantom@…>">

And i have query

a = $("tr[key='<1291012254.6.phantom@…>']")

Now a - is array with one text node, nodeValue is "<1291012254.6.phantom@…>"

But, i expect array with TR node

Bug?

--- Dmitry Minkin

Change History (9)

comment:1 Changed 5 years ago by dmethvin

Component: unfiledcore
Milestone: None1.9
Priority: undecidedhigh

This is running afoul of the "looks like HTML" rule, which sees the <> in the string and processes it like $(html) instead of $(selector). As of jQuery 1.9 we'll require any string processed by $(html) to *start* with a < character, otherwise it will be treated as a selector. For cases where you want leading text nodes there is already $.parseHTML() which needs documentation still.

comment:2 Changed 5 years ago by dmethvin

Status: newopen

comment:3 Changed 5 years ago by 3ds

I wrote a fix for this, the pull request can be found here:

https://github.com/jquery/jquery/pull/928

comment:4 Changed 5 years ago by Rick Waldron

Owner: set to Rick Waldron
Status: openassigned

comment:5 Changed 5 years ago by Rick Waldron

I've got a much smaller patch for this, but there is still an outstanding issue to address. Unfortunately I have to leave and drive 4 hours to Boston so I'll update when it's complete.

comment:6 Changed 5 years ago by gibson042

Isn't this a duplicate of #11290 ?

comment:7 Changed 5 years ago by Rick Waldron

Related, but not a dup

comment:8 Changed 5 years ago by dmethvin

Resolution: duplicate
Status: assignedclosed

Duplicate of #11290.
Although this isn't an exact dup of #11290 it will be fixed when we simplify the "looks like HTML rule".

comment:9 Changed 4 years ago by dmethvin

Milestone: 1.9None
Note: See TracTickets for help on using tickets.