Skip to content

Commit

Permalink
Fixed #2037 where Opera would mis-state the value of 'display' after …
Browse files Browse the repository at this point in the history
…an innerHTML was done in some cases.
  • Loading branch information
davids549 committed Dec 17, 2007
1 parent adc4c48 commit 6496e4d
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
6 changes: 6 additions & 0 deletions src/core.js
Expand Up @@ -816,6 +816,12 @@ jQuery.extend({
"1" :
ret;
}
// Opera sometimes will give the wrong display answer, this fixes it, see #2037
if ( jQuery.browser.opera && name == "display" ) {
var save = elem.style.display;
elem.style.display = "block";
elem.style.display = save;
}

// Make sure we're using the right name for getting the float value
if ( name.match( /float/i ) )
Expand Down
3 changes: 3 additions & 0 deletions test/index.html
Expand Up @@ -172,6 +172,9 @@ <h2 id="userAgent"></h2>
</div>
</form>
<div id="nonnodes"><span>hi</span> there <!-- mon ami --></div>
<div id="t2037">
<div><div class="hidden">hidden</div></div>
</div>
</div>
</div>
</dl>
Expand Down
8 changes: 6 additions & 2 deletions test/unit/core.js
Expand Up @@ -420,7 +420,7 @@ test("css(String|Hash)", function() {
});

test("css(String, Object)", function() {
expect(20);
expect(21);
ok( $('#foo').is(':visible'), 'Modifying CSS display: Assert element is visible');
$('#foo').css('display', 'none');
ok( !$('#foo').is(':visible'), 'Modified CSS display: Assert element is hidden');
Expand Down Expand Up @@ -454,6 +454,10 @@ test("css(String, Object)", function() {
var j = $("#nonnodes").contents();
j.css("padding-left", "1px");
equals( j.css("padding-left"), "1px", "Check node,textnode,comment css works" );

// opera sometimes doesn't update 'display' correctly, see #2037
$("#t2037")[0].innerHTML = $("#t2037")[0].innerHTML
equals( $("#t2037 .hidden").css("display"), "none", "Make sure browser thinks it is hidden" );
});

test("jQuery.css(elem, 'height') doesn't clear radio buttons (bug #1095)", function () {
Expand Down Expand Up @@ -1368,4 +1372,4 @@ test("contents()", function() {
var c = $("#nonnodes").contents().contents();
equals( c.length, 1, "Check node,textnode,comment contents is just one" );
equals( c[0].nodeValue, "hi", "Check node,textnode,comment contents is just the one from span" );
});
});

0 comments on commit 6496e4d

Please sign in to comment.