Skip to main content

Bug Tracker

Side navigation

#12965 closed bug (notabug)

Opened November 27, 2012 03:23AM UTC

Closed November 27, 2012 02:55PM UTC

Problem opera and method prepend

Reported by: uginroot@gmail.com Owned by: uginroot@gmail.com
Priority: undecided Milestone: None
Component: unfiled Version: 1.8.3
Keywords: Cc:
Blocked by: Blocking:
Description

$(document).ready(function(){

$.test();

});

$.test = function(){

var form = "<form id='test_jquery'><select class='select' name='select2'></select></form>";

var $form = $(form);

$('body').append($form);

var option = [

['Not select 1', 'test', true],

['Select', 'new', false],

['Not select 2', 'test2', false],

];

var $option = $('<option>');

for(i in option){

var $elem = $option.clone(true);

$elem.text(option[i][0]);

$elem.val(option[i][1]);

$elem.addClass(option[i][1]);

if(option[i][2] == true){

$elem.attr('selected', true);

}

if there append all works

$form.find('.select').prepend($elem);

}

var test1 = $('#test_jquery .select2 option:selected').val() == 'test'; true all browsers

$('#test_jquery .select2 .new').attr('selected', true);

test2 = $('#test_jquery .select2 option:selected').val() == 'new' && $('#test_jquery .select2 option:selected').length == 1; //true all browsers but opera false

}

Attachments (0)
Change History (3)

Changed November 27, 2012 03:26AM UTC by rwaldron comment:1

owner: → uginroot@gmail.com
status: newpending

Thanks for taking the time to contribute to the jQuery project! Please provide a complete reduced test case on jsFiddle to help us assess your ticket!

Additionally, be sure to test against the "jQuery (edge)" version to ensure the issue still exists. To get you started, use this boilerplate: http://jsfiddle.net/FrKyN/

Open the link and click to "Fork" (in the top menu) to begin.

Changed November 27, 2012 08:48AM UTC by anonymous comment:2

Check in opera (select2) and iPhone safari (radio)

http://jsfiddle.net/XVteT/

Changed November 27, 2012 02:55PM UTC by dmethvin comment:3

resolution: → notabug
status: pendingclosed

There's way too much code here for a test case. Please ask for help on a forum to determine whether the code is correct before assuming it's caused by a jQuery bug. Also, please do not attach your own unrelated data to the jQuery ($) object, it is bad practice.