Modify ↓
Ticket #4913 (closed bug: worksforme)
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: | |
| Blocking: | Blocked by: |
Description (last modified by dmethvin) (diff)
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.
Change History
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.
Note: See
TracTickets for help on using
tickets.

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.