Skip to content
Permalink
Browse files

Blackberry 4.6 doesn't maintain comment nodes in the DOM, ignore them…

… in our test cases.
  • Loading branch information...
jeresig committed Aug 26, 2010
1 parent 1e9d6e1 commit 9ce1d09a0a002eb147411166dee800335a60f4e4
Showing with 6 additions and 2 deletions.
  1. +6 −2 test/unit/manipulation.js
@@ -22,7 +22,9 @@ var testText = function(valueObj) {
j.text(valueObj("hi!"));
equals( jQuery(j[0]).text(), "hi!", "Check node,textnode,comment with text()" );
equals( j[1].nodeValue, " there ", "Check node,textnode,comment with text()" );
equals( j[2].nodeType, 8, "Check node,textnode,comment with text()" );

// Blackberry 4.6 doesn't maintain comments in the DOM
equals( jQuery("#nonnodes")[0].childNodes.length < 3 ? 8 : j[2].nodeType, 8, "Check node,textnode,comment with text()" );
}

test("text(String)", function() {
@@ -72,7 +74,9 @@ var testWrap = function(val) {
// using contents will get comments regular, text, and comment nodes
var j = jQuery("#nonnodes").contents();
j.wrap(val( "<i></i>" ));
equals( jQuery("#nonnodes > i").length, 3, "Check node,textnode,comment wraps ok" );

// Blackberry 4.6 doesn't maintain comments in the DOM
equals( jQuery("#nonnodes > i").length, jQuery("#nonnodes")[0].childNodes.length, "Check node,textnode,comment wraps ok" );
equals( jQuery("#nonnodes > i").text(), j.text(), "Check node,textnode,comment wraps doesn't hurt text" );

// Try wrapping a disconnected node

2 comments on commit 9ce1d09

@GarrettS

This comment has been minimized.

Copy link

replied Aug 27, 2010

So blackberry just drops the comment node, huh?
Why make assertions on presence of comments though?
The assertion message does not completely match what the assertion does. Do you think the test assertion is too complicated?

@jeresig

This comment has been minimized.

Copy link
Member Author

replied Aug 27, 2010

The assertion on comment nodes is rather important as we need to make sure that the text and wrapping methods handle them correctly in all the browsers that support comments. Since they appear to not exist in the Blackberry DOM at this point in the test it's kind of a moot point.

Please sign in to comment.
You can’t perform that action at this time.