Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test namespace prefix for element equality #6554

Merged
merged 1 commit into from Jul 14, 2015
Merged
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

@@ -2368,8 +2368,8 @@ impl<'a> NodeMethods for &'a Node {
fn is_equal_element(node: &Node, other: &Node) -> bool {
let element: &Element = ElementCast::to_ref(node).unwrap();
let other_element: &Element = ElementCast::to_ref(other).unwrap();
// FIXME: namespace prefix
(*element.namespace() == *other_element.namespace()) &&
(*element.prefix() == *other_element.prefix()) &&
(*element.local_name() == *other_element.local_name()) &&
(element.attrs().len() == other_element.attrs().len())
}
@@ -1,3 +1,6 @@
[Node-isEqualNode.xhtml]
type: testharness
disabled: xml
expected: TIMEOUT
[isEqualNode should return true when only the internal subsets of DocumentTypes differ.]
expected: NOTRUN

@@ -33,6 +33,30 @@ test(function() {
assert_true(a.isEqualNode(b))
}, "isEqualNode should return true when the attributes are in a different order")

test(function() {
var a = document.createElementNS("ns", "prefix:foo")
var b = document.createElementNS("ns", "prefix:foo")
assert_true(a.isEqualNode(b))
}, "isEqualNode should return true if elements have same namespace, prefix, and local name")

test(function() {
var a = document.createElementNS("ns1", "prefix:foo")
var b = document.createElementNS("ns2", "prefix:foo")
assert_false(a.isEqualNode(b))
}, "isEqualNode should return false if elements have different namespace")

test(function() {
var a = document.createElementNS("ns", "prefix1:foo")
var b = document.createElementNS("ns", "prefix2:foo")
assert_false(a.isEqualNode(b))
}, "isEqualNode should return false if elements have different prefix")

test(function() {
var a = document.createElementNS("ns", "prefix:foo1")
var b = document.createElementNS("ns", "prefix:foo2")
assert_false(a.isEqualNode(b))
}, "isEqualNode should return false if elements have different local name")

test(function() {
var a = document.createElement("foo")
a.setAttributeNS("ns", "x:a", "bar")
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.