Bug Tracker

Modify

Ticket #8967 (closed bug: worksforme)

Opened 2 years ago

Last modified 2 years ago

Selector [value=XXX] regress in 1.5.2

Reported by: grigorenko@… Owned by: grigorenko@…
Priority: low Milestone: 1.next
Component: selector Version: 1.5.2
Keywords: Cc:
Blocking: Blocked by:

Description

Selector "SELECT[name=FOO] option[value=BAR]" works in 1.4.4 and doesn't work in 1.5.2

In 1.5.2 there's error:

Uncaught Syntax error, unrecognized expression: [value=D:\Results\BDS2007\EXE\MitraMessageCenterApp.exe] k.errorjquery.js:16 k.filterjquery.js:16 kjquery.js:16 c.querySelectorAll.kjquery.js:16 d.fn.extend.findjquery.js:16 d.d.fn.d.initjquery.js:16 d.djquery.js:16 check_add:2222/:201 update:2222/:144 d.extend._Deferred.f.resolveWithjquery.js:16 vjquery.js:16 d.support.ajax.d.ajaxTransport.send.cjquery.js:16

I'm trying to append option to SELECT only if there isn't one there already:

function check_add(select_name, value) {
	if ($("SELECT[name=" + select_name + "] option[value=" + value + "]").length == 0) {
		$("SELECT[name=" + select_name + "]").append($("<option />").text(value || '').val(value || ''));
	}
}

Using Chrome 10.0.648.205 under Windows XP.

Change History

comment:1 Changed 2 years ago by timmywil

  • Owner set to grigorenko@…
  • Priority changed from undecided to low
  • Status changed from new to pending
  • Component changed from unfiled to selector

Thanks for taking the time to contribute to the jQuery project! Please provide a reduced test case on  http://jsFiddle.net that reproduces the issue experienced to help us assess your ticket. Additionally, test against the jQuery (edge) version to ensure the issue still exists. I've created one here, but was unable to reproduce the issue described:  http://jsfiddle.net/timmywil/CppFb/

comment:2 Changed 2 years ago by rwaldron

  • Status changed from pending to closed
  • Resolution set to worksforme

Test in chrome 10 & 12 on windows XP:

 http://jsfiddle.net/rwaldron/JKZ2t/

comment:3 Changed 2 years ago by grigorenko@…

The problem exists:

 http://jsfiddle.net/JKZ2t/2/

Works in 1.4.4, doesn't work in 1.5.2 and edge:

"Syntax error, unrecognized expression: [value=D:\Results\BDS2007\EXE\TestEntityTransport.exe]"

comment:4 Changed 2 years ago by grigorenko@…

Sorry, the right link is:

 http://jsfiddle.net/JKZ2t/3/

comment:5 Changed 2 years ago by timmywil

Quotes around the value are mandatory:  http://jsfiddle.net/timmywil/JKZ2t/8/

comment:6 Changed 2 years ago by anonymous

I got the same error. After add quotes to the value in selector, the error msg went away. Thanks, timmywil.

comment:7 Changed 2 years ago by grigorenko@…

Forgot about quotes. Sorry, my mistake.

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.