Bug Tracker

Opened 6 years ago

Closed 6 years ago

#14460 closed bug (notabug)

.remove() inconsistent between Safari and Chrome

Reported by: dereekb@… Owned by:
Priority: undecided Milestone: None
Component: unfiled Version: 2.0.3
Keywords: Cc:
Blocked by: Blocking:

Description

Chrome Version: 30.0.1599.101 Safari Version: 6.0.5 (8536.30.1)

The following code will run successfully in Chrome, but not in Safari.

   var results = $( "p" ),
       result = null,
    
       i;
    
    for(i = 0; i < results.length; i += 1)
    {
        result = results[i];
        result.remove();
    }

JSFiddle Test: http://jsfiddle.net/YqCzK/

In Safari, the segment will fail at result.remove() since the object does not have the remove function available (Actual error is 'undefined' is not a function.).

Calling remove() on the results array works in both browsers however.

Change History (2)

comment:1 Changed 6 years ago by anonymous

result = results[i]

is not a jQuery-object anymore, thus don't have a $().remove()-function.

Either use

result = $(results[i])

or

result = results.eq(i)

comment:2 Changed 6 years ago by dmethvin

Resolution: notabug
Status: newclosed

Agree, anonymous.

Note: See TracTickets for help on using tickets.