aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/htmlaudioelement.rs
diff options
context:
space:
mode:
authorWarren Fisher <github@warrenfisher.dev>2020-01-04 15:52:45 -0400
committerWarren Fisher <github@warrenfisher.dev>2020-01-04 16:14:03 -0400
commit6e296150f84f84c3679ea89d7b9f2c8e6325b242 (patch)
treea29a48ed38ceb64309ced2babaa8693628a9432c /components/script/dom/htmlaudioelement.rs
parentafa1b85766caeb55254b739529aef205f04d3585 (diff)
downloadservo-6e296150f84f84c3679ea89d7b9f2c8e6325b242.tar.gz
servo-6e296150f84f84c3679ea89d7b9f2c8e6325b242.zip
use create_html_element for HTMLAudioElement and HTMLImageElement
Diffstat (limited to 'components/script/dom/htmlaudioelement.rs')
-rw-r--r--components/script/dom/htmlaudioelement.rs15
1 files changed, 11 insertions, 4 deletions
diff --git a/components/script/dom/htmlaudioelement.rs b/components/script/dom/htmlaudioelement.rs
index af92835af6a..a510ab93a5f 100644
--- a/components/script/dom/htmlaudioelement.rs
+++ b/components/script/dom/htmlaudioelement.rs
@@ -10,12 +10,12 @@ use crate::dom::bindings::inheritance::Castable;
use crate::dom::bindings::root::DomRoot;
use crate::dom::bindings::str::DOMString;
use crate::dom::document::Document;
-use crate::dom::element::Element;
+use crate::dom::element::{CustomElementCreationMode, Element, ElementCreator};
use crate::dom::htmlmediaelement::HTMLMediaElement;
use crate::dom::node::Node;
use crate::dom::window::Window;
use dom_struct::dom_struct;
-use html5ever::{LocalName, Prefix};
+use html5ever::{LocalName, Prefix, QualName};
#[dom_struct]
pub struct HTMLAudioElement {
@@ -50,8 +50,15 @@ impl HTMLAudioElement {
// https://html.spec.whatwg.org/multipage/#dom-audio
pub fn Audio(window: &Window, src: Option<DOMString>) -> Fallible<DomRoot<HTMLAudioElement>> {
- let document = window.Document();
- let audio = HTMLAudioElement::new(local_name!("audio"), None, &document);
+ let element = Element::create(
+ QualName::new(None, ns!(html), local_name!("audio")),
+ None,
+ &window.Document(),
+ ElementCreator::ScriptCreated,
+ CustomElementCreationMode::Synchronous,
+ );
+
+ let audio = DomRoot::downcast::<HTMLAudioElement>(element).unwrap();
audio
.upcast::<Element>()