mirror of
https://github.com/servo/servo.git
synced 2025-07-23 15:23:42 +01:00
Auto merge of #6559 - kball:IS1824-implement-Node.baseURI, r=Ms2ger
Implement Node.baseURI Addresses Issue #1824. Implements Node.baseURI based on https://www.w3.org/Bugs/Public/show_bug.cgi?id=20976#c32 <!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/6559) <!-- Reviewable:end -->
This commit is contained in:
commit
1e16047846
5 changed files with 42 additions and 7 deletions
|
@ -987,7 +987,7 @@ impl<'a> NodeHelpers for &'a Node {
|
||||||
fn summarize(self) -> NodeInfo {
|
fn summarize(self) -> NodeInfo {
|
||||||
NodeInfo {
|
NodeInfo {
|
||||||
uniqueId: self.get_unique_id(),
|
uniqueId: self.get_unique_id(),
|
||||||
baseURI: self.GetBaseURI().unwrap_or("".to_owned()),
|
baseURI: self.BaseURI(),
|
||||||
parent: self.GetParentNode().map(|node| node.r().get_unique_id()).unwrap_or("".to_owned()),
|
parent: self.GetParentNode().map(|node| node.r().get_unique_id()).unwrap_or("".to_owned()),
|
||||||
nodeType: self.NodeType(),
|
nodeType: self.NodeType(),
|
||||||
namespaceURI: "".to_owned(), //FIXME
|
namespaceURI: "".to_owned(), //FIXME
|
||||||
|
@ -1950,9 +1950,8 @@ impl<'a> NodeMethods for &'a Node {
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://dom.spec.whatwg.org/#dom-node-baseuri
|
// https://dom.spec.whatwg.org/#dom-node-baseuri
|
||||||
fn GetBaseURI(self) -> Option<DOMString> {
|
fn BaseURI(self) -> DOMString {
|
||||||
// FIXME (#1824) implement.
|
self.owner_doc().URL()
|
||||||
None
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://dom.spec.whatwg.org/#dom-node-ownerdocument
|
// https://dom.spec.whatwg.org/#dom-node-ownerdocument
|
||||||
|
|
|
@ -26,7 +26,7 @@ interface Node : EventTarget {
|
||||||
readonly attribute DOMString nodeName;
|
readonly attribute DOMString nodeName;
|
||||||
|
|
||||||
[Pure]
|
[Pure]
|
||||||
readonly attribute DOMString? baseURI;
|
readonly attribute DOMString baseURI;
|
||||||
|
|
||||||
[Pure]
|
[Pure]
|
||||||
readonly attribute Document? ownerDocument;
|
readonly attribute Document? ownerDocument;
|
||||||
|
|
|
@ -13117,6 +13117,10 @@
|
||||||
"path": "dom/nodes/Node-appendChild.html",
|
"path": "dom/nodes/Node-appendChild.html",
|
||||||
"url": "/dom/nodes/Node-appendChild.html"
|
"url": "/dom/nodes/Node-appendChild.html"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"path": "dom/nodes/Node-baseURI.html",
|
||||||
|
"url": "/dom/nodes/Node-baseURI.html"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"path": "dom/nodes/Node-childNodes.html",
|
"path": "dom/nodes/Node-childNodes.html",
|
||||||
"url": "/dom/nodes/Node-childNodes.html"
|
"url": "/dom/nodes/Node-childNodes.html"
|
||||||
|
@ -31931,4 +31935,4 @@
|
||||||
"rev": "87398b8448f699e3e324148795891658f2fa16dd",
|
"rev": "87398b8448f699e3e324148795891658f2fa16dd",
|
||||||
"url_base": "/",
|
"url_base": "/",
|
||||||
"version": 2
|
"version": 2
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
[The fallback base URL of a document containing no base element is the document's address.]
|
[The fallback base URL of a document containing no base element is the document's address.]
|
||||||
expected: FAIL
|
expected: PASS
|
||||||
|
|
||||||
[The fallback base URL of a document whose address is about:blank is the document base URL of the creator document.]
|
[The fallback base URL of a document whose address is about:blank is the document base URL of the creator document.]
|
||||||
expected: TIMEOUT
|
expected: TIMEOUT
|
||||||
|
|
32
tests/wpt/web-platform-tests/dom/nodes/Node-baseURI.html
Normal file
32
tests/wpt/web-platform-tests/dom/nodes/Node-baseURI.html
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<title>Node.baseURI</title>
|
||||||
|
<script src="/resources/testharness.js"></script>
|
||||||
|
<script src="/resources/testharnessreport.js"></script>
|
||||||
|
<div id="log"></div>
|
||||||
|
<script>
|
||||||
|
test(function() {
|
||||||
|
var element = document.createElement("div");
|
||||||
|
document.body.appendChild(element);
|
||||||
|
assert_equals(element.baseURI, document.URL);
|
||||||
|
}, "For elements belonging to document, baseURI should be document url")
|
||||||
|
|
||||||
|
test(function() {
|
||||||
|
var element = document.createElement("div");
|
||||||
|
assert_equals(element.baseURI, document.URL);
|
||||||
|
}, "For elements unassigned to document, baseURI should be document url")
|
||||||
|
|
||||||
|
test(function() {
|
||||||
|
var fragment = document.createDocumentFragment();
|
||||||
|
var element = document.createElement("div");
|
||||||
|
fragment.appendChild(element);
|
||||||
|
assert_equals(element.baseURI, document.URL)
|
||||||
|
}, "For elements belonging to document fragments, baseURI should be document url")
|
||||||
|
|
||||||
|
test(function() {
|
||||||
|
var fragment = document.createDocumentFragment();
|
||||||
|
var element = document.createElement("div");
|
||||||
|
fragment.appendChild(element);
|
||||||
|
document.body.appendChild(fragment);
|
||||||
|
assert_equals(element.baseURI, document.URL)
|
||||||
|
}, "After inserting fragment into document, element baseURI should be document url")
|
||||||
|
</script>
|
Loading…
Add table
Add a link
Reference in a new issue