Skip to main content

Bug Tracker

Side navigation

#4913 closed bug (worksforme)

Opened July 17, 2009 09:25AM UTC

Closed November 09, 2010 07:52AM UTC

Safari multiple class select fail on disconnected elements

Reported by: Larry Battle Owned by:
Priority: major Milestone: 1.4
Component: selector Version: 1.3.2
Keywords: plus, safari multiple selector, jquery code Cc:
Blocked by: Blocking:
Description

I have one question and one problem.

Problem

Safari fails when selecting multiple selectors|elements from variables that have not been attached to the DOM. Other browsers work just fine.

<div id="output"/>
var q = $( "<p/>" ).append(
		$( "<div/>" ).attr({"class": "input1", "id": "inputId1" }),
		$( "<div/>" ).attr({ "class": "input2", "id": "inputId2" }),
		$( "<div/>" ).attr({ "class": "input3", "id": "inputId3" })
	);

//The follow does not work in safari.
	$( ".input1, .input2, .input3", q ).html( "classes were found and..." );
	$( "#output" ).html( q.html() );
	$( "#inputId1, #inputId2, #inputId3" ).each(function( i, e ){
		$( e ).html("ids were found.");
		alert("Change");
	});

Question

Does a plus in front of a variable do something special in javascript or is it there for a reminder or something?

Example. In jQuery 1.3.2 in the function eq, it has +i.

eq: function( i ) {
return this.slice( i, +i + 1 );
},

It's also in the now function. With return +new Date;

Thank you for your help.

Attachments (0)
Change History (2)

Changed June 13, 2010 01:36PM UTC by dmethvin comment:1

component: unfiledselector
description: I have one question and one problem. \ \ '''Question''' \ Does a plus in front of a variable do something special in javascript or is it there for a reminder or something? \ \ Example. In jQuery 1.3.2 in the function eq, it has +i. \ {{{ \ eq: function( i ) { \ return this.slice( i, +i + 1 ); \ }, \ }}} \ It's also in the now function. With return +new Date; \ \ \ '''Problem''' \ Safari fails when selecting multiple selectors|elements from variables that have not been attached to the DOM. Other browsers work just fine. \ {{{ \ <div id="output"/> \ }}} \ {{{ \ var q = $( "<p/>" ).append( \ $( "<div/>" ).attr({"class": "input1", "id": "inputId1" }), \ $( "<div/>" ).attr({ "class": "input2", "id": "inputId2" }), \ $( "<div/>" ).attr({ "class": "input3", "id": "inputId3" }) \ ); \ \ //The follow does not work in safari. \ $( ".input1, .input2, .input3", q ).html( "classes were found and..." ); \ $( "#output" ).html( q.html() ); \ $( "#inputId1, #inputId2, #inputId3" ).each(function( i, e ){ \ $( e ).html("ids were found."); \ alert("Change"); \ }); \ }}} \ \ Thank you for your help.I have one question and one problem. \ \ '''Problem''' \ Safari fails when selecting multiple selectors|elements from variables that have not been attached to the DOM. Other browsers work just fine. \ {{{ \ <div id="output"/> \ }}} \ {{{ \ var q = $( "<p/>" ).append( \ $( "<div/>" ).attr({"class": "input1", "id": "inputId1" }), \ $( "<div/>" ).attr({ "class": "input2", "id": "inputId2" }), \ $( "<div/>" ).attr({ "class": "input3", "id": "inputId3" }) \ ); \ \ //The follow does not work in safari. \ $( ".input1, .input2, .input3", q ).html( "classes were found and..." ); \ $( "#output" ).html( q.html() ); \ $( "#inputId1, #inputId2, #inputId3" ).each(function( i, e ){ \ $( e ).html("ids were found."); \ alert("Change"); \ }); \ }}} \ \ '''Question''' \ Does a plus in front of a variable do something special in javascript or is it there for a reminder or something? \ \ Example. In jQuery 1.3.2 in the function eq, it has +i. \ {{{ \ eq: function( i ) { \ return this.slice( i, +i + 1 ); \ }, \ }}} \ It's also in the now function. With return +new Date; \ \ \ Thank you for your help.
summary: Safari multiple class select fail. Also was does plus mean?Safari multiple class select fail on disconnected elements

The unary plus operator converts a value to a number, or to NaN if the value isn't a number. I'll leave the ticket open for the bug.

Changed November 09, 2010 07:52AM UTC by snover comment:2

resolution: → worksforme
status: newclosed