Allow element prefix to be set

Implements step 6.1.10 of
https://dom.spec.whatwg.org/#concept-create-element
This commit is contained in:
Connor Brewster 2017-06-23 14:21:50 -06:00
parent dd9bb0550b
commit 37e8b89377
6 changed files with 26 additions and 17 deletions

View file

@ -24,7 +24,7 @@ use dom::node::Node;
use dom::promise::Promise;
use dom::window::Window;
use dom_struct::dom_struct;
use html5ever::LocalName;
use html5ever::{LocalName, Prefix};
use js::conversions::ToJSValConvertible;
use js::jsapi::{Construct1, IsConstructor, HandleValueArray, HandleObject};
use js::jsapi::{JS_GetProperty, JSAutoCompartment, JSContext};
@ -281,7 +281,7 @@ impl CustomElementDefinition {
/// https://dom.spec.whatwg.org/#concept-create-element Step 6.1
#[allow(unsafe_code)]
pub fn create_element(&self, document: &Document) -> Fallible<Root<Element>> {
pub fn create_element(&self, document: &Document, prefix: Option<Prefix>) -> Fallible<Root<Element>> {
let window = document.window();
let cx = window.get_cx();
// Step 2
@ -320,6 +320,9 @@ impl CustomElementDefinition {
return Err(Error::NotSupported);
}
// Step 10
element.set_prefix(prefix);
// Step 11
// Element's `is` is None by default