aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/htmlaudioelement.rs
diff options
context:
space:
mode:
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>()