mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Auto merge of #5921 - nox:document-getter, r=jdm
<!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/5921) <!-- Reviewable:end -->
This commit is contained in:
commit
a635a8f953
22 changed files with 176 additions and 235 deletions
|
@ -23,6 +23,7 @@ use dom::bindings::codegen::InheritTypes::{HTMLAreaElementDerived, HTMLEmbedElem
|
|||
use dom::bindings::codegen::InheritTypes::{HTMLFormElementDerived, HTMLImageElementDerived};
|
||||
use dom::bindings::codegen::InheritTypes::{HTMLScriptElementDerived, HTMLTitleElementDerived};
|
||||
use dom::bindings::codegen::UnionTypes::NodeOrString;
|
||||
use dom::bindings::conversions::ToJSValConvertible;
|
||||
use dom::bindings::error::{ErrorResult, Fallible};
|
||||
use dom::bindings::error::Error::{NotSupported, InvalidCharacter, Security};
|
||||
use dom::bindings::error::Error::HierarchyRequest;
|
||||
|
@ -84,7 +85,7 @@ use html5ever::tree_builder::{QuirksMode, NoQuirks, LimitedQuirks, Quirks};
|
|||
use layout_interface::{LayoutChan, Msg};
|
||||
use string_cache::{Atom, QualName};
|
||||
use url::Url;
|
||||
use js::jsapi::JSRuntime;
|
||||
use js::jsapi::{JSContext, JSObject, JSRuntime};
|
||||
|
||||
use num::ToPrimitive;
|
||||
use std::iter::FromIterator;
|
||||
|
@ -94,6 +95,7 @@ use std::collections::hash_map::Entry::{Occupied, Vacant};
|
|||
use std::ascii::AsciiExt;
|
||||
use std::cell::{Cell, Ref, RefMut, RefCell};
|
||||
use std::default::Default;
|
||||
use std::ptr;
|
||||
use std::sync::mpsc::{Receiver, channel};
|
||||
use time;
|
||||
|
||||
|
@ -1661,6 +1663,94 @@ impl<'a> DocumentMethods for JSRef<'a, Document> {
|
|||
self.set_body_attribute(&atom!("bgcolor"), value)
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/#dom-tree-accessors:dom-document-nameditem-filter
|
||||
fn NamedGetter(self, cx: *mut JSContext, name: DOMString, found: &mut bool)
|
||||
-> *mut JSObject {
|
||||
#[jstraceable]
|
||||
struct NamedElementFilter {
|
||||
name: Atom,
|
||||
}
|
||||
impl CollectionFilter for NamedElementFilter {
|
||||
fn filter(&self, elem: JSRef<Element>, _root: JSRef<Node>) -> bool {
|
||||
filter_by_name(&self.name, NodeCast::from_ref(elem))
|
||||
}
|
||||
}
|
||||
// https://html.spec.whatwg.org/#dom-document-nameditem-filter
|
||||
fn filter_by_name(name: &Atom, node: JSRef<Node>) -> bool {
|
||||
let html_elem_type = match node.type_id() {
|
||||
NodeTypeId::Element(ElementTypeId::HTMLElement(type_)) => type_,
|
||||
_ => return false,
|
||||
};
|
||||
let elem = match ElementCast::to_ref(node) {
|
||||
Some(elem) => elem,
|
||||
None => return false,
|
||||
};
|
||||
match html_elem_type {
|
||||
HTMLElementTypeId::HTMLAppletElement => {
|
||||
match elem.get_attribute(&ns!(""), &atom!("name")).root() {
|
||||
Some(ref attr) if attr.r().value().atom() == Some(name) => true,
|
||||
_ => {
|
||||
match elem.get_attribute(&ns!(""), &atom!("id")).root() {
|
||||
Some(ref attr) => attr.r().value().atom() == Some(name),
|
||||
None => false,
|
||||
}
|
||||
},
|
||||
}
|
||||
},
|
||||
HTMLElementTypeId::HTMLFormElement => {
|
||||
match elem.get_attribute(&ns!(""), &atom!("name")).root() {
|
||||
Some(ref attr) => attr.r().value().atom() == Some(name),
|
||||
None => false,
|
||||
}
|
||||
},
|
||||
HTMLElementTypeId::HTMLImageElement => {
|
||||
match elem.get_attribute(&ns!(""), &atom!("name")).root() {
|
||||
Some(ref attr) => {
|
||||
if attr.r().value().atom() == Some(name) {
|
||||
true
|
||||
} else {
|
||||
match elem.get_attribute(&ns!(""), &atom!("id")).root() {
|
||||
Some(ref attr) => attr.r().value().atom() == Some(name),
|
||||
None => false,
|
||||
}
|
||||
}
|
||||
},
|
||||
None => false,
|
||||
}
|
||||
},
|
||||
// TODO: Handle <embed>, <iframe> and <object>.
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
let name = Atom::from_slice(&name);
|
||||
let root = NodeCast::from_ref(self);
|
||||
{
|
||||
// Step 1.
|
||||
let mut elements = root.traverse_preorder().filter(|node| {
|
||||
let node = node.root();
|
||||
filter_by_name(&name, node.r())
|
||||
}).peekable();
|
||||
if let Some(first) = elements.next() {
|
||||
let first = first.root();
|
||||
if elements.is_empty() {
|
||||
*found = true;
|
||||
// TODO: Step 2.
|
||||
// Step 3.
|
||||
return first.to_jsval(cx).to_object();
|
||||
}
|
||||
} else {
|
||||
*found = false;
|
||||
return ptr::null_mut();
|
||||
}
|
||||
}
|
||||
// Step 4.
|
||||
*found = true;
|
||||
let window = self.window().root();
|
||||
let filter = NamedElementFilter { name: name };
|
||||
let collection = HTMLCollection::create(window.r(), root, box filter).root();
|
||||
collection.to_jsval(cx).to_object()
|
||||
}
|
||||
|
||||
global_event_handlers!();
|
||||
event_handler!(readystatechange, GetOnreadystatechange, SetOnreadystatechange);
|
||||
}
|
||||
|
|
|
@ -3,13 +3,20 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use dom::bindings::codegen::Bindings::HTMLAppletElementBinding;
|
||||
use dom::bindings::codegen::Bindings::HTMLAppletElementBinding::HTMLAppletElementMethods;
|
||||
|
||||
use dom::attr::AttrValue;
|
||||
use dom::bindings::codegen::InheritTypes::HTMLAppletElementDerived;
|
||||
use dom::bindings::codegen::InheritTypes::HTMLElementCast;
|
||||
use dom::bindings::js::{JSRef, Temporary};
|
||||
use dom::document::Document;
|
||||
use dom::element::ElementTypeId;
|
||||
use dom::element::{AttributeHandlers, ElementTypeId};
|
||||
use dom::eventtarget::{EventTarget, EventTargetTypeId};
|
||||
use dom::htmlelement::{HTMLElement, HTMLElementTypeId};
|
||||
use dom::node::{Node, NodeTypeId};
|
||||
use dom::virtualmethods::VirtualMethods;
|
||||
|
||||
use string_cache::Atom;
|
||||
use util::str::DOMString;
|
||||
|
||||
#[dom_struct]
|
||||
|
@ -37,3 +44,21 @@ impl HTMLAppletElement {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'a> HTMLAppletElementMethods for JSRef<'a, HTMLAppletElement> {
|
||||
// https://html.spec.whatwg.org/#the-applet-element:dom-applet-name
|
||||
make_getter!(Name);
|
||||
make_atomic_setter!(SetName, "name");
|
||||
}
|
||||
|
||||
impl<'a> VirtualMethods for JSRef<'a, HTMLAppletElement> {
|
||||
fn super_type<'b>(&'b self) -> Option<&'b VirtualMethods> {
|
||||
Some(HTMLElementCast::from_borrowed_ref(self) as &VirtualMethods)
|
||||
}
|
||||
|
||||
fn parse_plain_attribute(&self, name: &Atom, value: DOMString) -> AttrValue {
|
||||
match name {
|
||||
&atom!("name") => AttrValue::from_atomic(value),
|
||||
_ => self.super_type().unwrap().parse_plain_attribute(name, value),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,7 +19,6 @@ use dom::virtualmethods::VirtualMethods;
|
|||
use dom::window::WindowHelpers;
|
||||
|
||||
use cssparser::RGBA;
|
||||
use string_cache::Atom;
|
||||
use util::str::{self, DOMString};
|
||||
|
||||
use std::borrow::ToOwned;
|
||||
|
|
|
@ -26,7 +26,6 @@ use std::ascii::OwnedAsciiExt;
|
|||
use std::borrow::ToOwned;
|
||||
use util::str::DOMString;
|
||||
use std::cell::Cell;
|
||||
use string_cache::Atom;
|
||||
|
||||
#[jstraceable]
|
||||
#[derive(PartialEq, Copy, Clone)]
|
||||
|
|
|
@ -14,7 +14,6 @@ use dom::htmlelement::{HTMLElement, HTMLElementTypeId};
|
|||
use dom::node::{Node, NodeTypeId};
|
||||
|
||||
use util::str::DOMString;
|
||||
use string_cache::Atom;
|
||||
|
||||
use std::borrow::ToOwned;
|
||||
|
||||
|
|
|
@ -20,7 +20,6 @@ use dom::validitystate::ValidityState;
|
|||
use dom::virtualmethods::VirtualMethods;
|
||||
|
||||
use util::str::{DOMString, StaticStringVec};
|
||||
use string_cache::Atom;
|
||||
|
||||
#[dom_struct]
|
||||
pub struct HTMLFieldSetElement {
|
||||
|
|
|
@ -2,15 +2,20 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use dom::attr::AttrValue;
|
||||
use dom::bindings::codegen::Bindings::DocumentBinding::DocumentMethods;
|
||||
use dom::bindings::codegen::Bindings::EventBinding::EventMethods;
|
||||
use dom::bindings::codegen::Bindings::HTMLFormElementBinding;
|
||||
use dom::bindings::codegen::Bindings::HTMLFormElementBinding::HTMLFormElementMethods;
|
||||
use dom::bindings::codegen::Bindings::HTMLInputElementBinding::HTMLInputElementMethods;
|
||||
use dom::bindings::codegen::Bindings::HTMLButtonElementBinding::HTMLButtonElementMethods;
|
||||
use dom::bindings::codegen::InheritTypes::{EventTargetCast, HTMLFormElementDerived, NodeCast};
|
||||
use dom::bindings::codegen::InheritTypes::{HTMLInputElementCast, HTMLTextAreaElementCast};
|
||||
use dom::bindings::codegen::InheritTypes::{HTMLFormElementCast, HTMLDataListElementCast};
|
||||
use dom::bindings::codegen::InheritTypes::EventTargetCast;
|
||||
use dom::bindings::codegen::InheritTypes::HTMLDataListElementCast;
|
||||
use dom::bindings::codegen::InheritTypes::HTMLElementCast;
|
||||
use dom::bindings::codegen::InheritTypes::HTMLFormElementCast;
|
||||
use dom::bindings::codegen::InheritTypes::HTMLFormElementDerived;
|
||||
use dom::bindings::codegen::InheritTypes::HTMLInputElementCast;
|
||||
use dom::bindings::codegen::InheritTypes::{HTMLTextAreaElementCast, NodeCast};
|
||||
use dom::bindings::global::GlobalRef;
|
||||
use dom::bindings::js::{JSRef, OptionalRootable, Rootable, Temporary};
|
||||
use dom::document::{Document, DocumentHelpers};
|
||||
|
@ -23,6 +28,7 @@ use dom::htmlinputelement::{HTMLInputElement, HTMLInputElementHelpers};
|
|||
use dom::htmlbuttonelement::{HTMLButtonElement};
|
||||
use dom::htmltextareaelement::HTMLTextAreaElementHelpers;
|
||||
use dom::node::{Node, NodeHelpers, NodeTypeId, document_from_node, window_from_node};
|
||||
use dom::virtualmethods::VirtualMethods;
|
||||
use hyper::method::Method;
|
||||
use hyper::header::ContentType;
|
||||
use hyper::mime;
|
||||
|
@ -107,9 +113,7 @@ impl<'a> HTMLFormElementMethods for JSRef<'a, HTMLFormElement> {
|
|||
|
||||
// https://html.spec.whatwg.org/multipage/#dom-form-name
|
||||
make_getter!(Name);
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/#dom-form-name
|
||||
make_setter!(SetName, "name");
|
||||
make_atomic_setter!(SetName, "name");
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/#dom-fs-novalidate
|
||||
make_bool_getter!(NoValidate);
|
||||
|
@ -559,3 +563,16 @@ pub trait FormControl<'a> : Copy + Sized {
|
|||
|
||||
fn to_element(self) -> JSRef<'a, Element>;
|
||||
}
|
||||
|
||||
impl<'a> VirtualMethods for JSRef<'a, HTMLFormElement> {
|
||||
fn super_type<'b>(&'b self) -> Option<&'b VirtualMethods> {
|
||||
Some(HTMLElementCast::from_borrowed_ref(self) as &VirtualMethods)
|
||||
}
|
||||
|
||||
fn parse_plain_attribute(&self, name: &Atom, value: DOMString) -> AttrValue {
|
||||
match name {
|
||||
&atom!("name") => AttrValue::from_atomic(value),
|
||||
_ => self.super_type().unwrap().parse_plain_attribute(name, value),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -229,9 +229,9 @@ impl<'a> HTMLImageElementMethods for JSRef<'a, HTMLImageElement> {
|
|||
image.is_some()
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/#dom-img-name
|
||||
make_getter!(Name);
|
||||
|
||||
make_setter!(SetName, "name");
|
||||
make_atomic_setter!(SetName, "name");
|
||||
|
||||
make_getter!(Align);
|
||||
|
||||
|
@ -288,6 +288,7 @@ impl<'a> VirtualMethods for JSRef<'a, HTMLImageElement> {
|
|||
|
||||
fn parse_plain_attribute(&self, name: &Atom, value: DOMString) -> AttrValue {
|
||||
match name {
|
||||
&atom!("name") => AttrValue::from_atomic(value),
|
||||
&atom!("width") | &atom!("height") |
|
||||
&atom!("hspace") | &atom!("vspace") => AttrValue::from_u32(value, 0),
|
||||
_ => self.super_type().unwrap().parse_plain_attribute(name, value),
|
||||
|
|
|
@ -12,7 +12,6 @@ use dom::element::ElementTypeId;
|
|||
use dom::htmlelement::{HTMLElement, HTMLElementTypeId};
|
||||
use dom::node::{Node, NodeTypeId};
|
||||
use util::str::DOMString;
|
||||
use string_cache::Atom;
|
||||
|
||||
#[dom_struct]
|
||||
pub struct HTMLMetaElement {
|
||||
|
|
|
@ -24,7 +24,6 @@ use dom::virtualmethods::VirtualMethods;
|
|||
use net_traits::image::base::Image;
|
||||
use util::str::DOMString;
|
||||
use std::sync::Arc;
|
||||
use string_cache::Atom;
|
||||
|
||||
#[dom_struct]
|
||||
pub struct HTMLObjectElement {
|
||||
|
|
|
@ -18,7 +18,6 @@ use dom::node::{DisabledStateHelpers, Node, NodeHelpers, NodeTypeId};
|
|||
use dom::virtualmethods::VirtualMethods;
|
||||
|
||||
use util::str::DOMString;
|
||||
use string_cache::Atom;
|
||||
|
||||
#[dom_struct]
|
||||
pub struct HTMLOptGroupElement {
|
||||
|
|
|
@ -22,7 +22,6 @@ use dom::node::{DisabledStateHelpers, Node, NodeHelpers, NodeTypeId};
|
|||
use dom::virtualmethods::VirtualMethods;
|
||||
|
||||
use util::str::{DOMString, split_html_space_chars};
|
||||
use string_cache::Atom;
|
||||
|
||||
#[dom_struct]
|
||||
pub struct HTMLOptionElement {
|
||||
|
|
|
@ -8,8 +8,7 @@ macro_rules! make_getter(
|
|||
fn $attr(self) -> DOMString {
|
||||
use dom::element::{Element, AttributeHandlers};
|
||||
use dom::bindings::codegen::InheritTypes::ElementCast;
|
||||
#[allow(unused_imports)]
|
||||
use std::ascii::AsciiExt;
|
||||
use string_cache::Atom;
|
||||
let element: JSRef<Element> = ElementCast::from_ref(self);
|
||||
element.get_string_attribute(&Atom::from_slice($htmlname))
|
||||
}
|
||||
|
@ -25,8 +24,7 @@ macro_rules! make_bool_getter(
|
|||
fn $attr(self) -> bool {
|
||||
use dom::element::{Element, AttributeHandlers};
|
||||
use dom::bindings::codegen::InheritTypes::ElementCast;
|
||||
#[allow(unused_imports)]
|
||||
use std::ascii::AsciiExt;
|
||||
use string_cache::Atom;
|
||||
let element: JSRef<Element> = ElementCast::from_ref(self);
|
||||
// FIXME(pcwalton): Do this at compile time, not runtime.
|
||||
element.has_attribute(&Atom::from_slice($htmlname))
|
||||
|
@ -43,8 +41,7 @@ macro_rules! make_uint_getter(
|
|||
fn $attr(self) -> u32 {
|
||||
use dom::element::{Element, AttributeHandlers};
|
||||
use dom::bindings::codegen::InheritTypes::ElementCast;
|
||||
#[allow(unused_imports)]
|
||||
use std::ascii::AsciiExt;
|
||||
use string_cache::Atom;
|
||||
let element: JSRef<Element> = ElementCast::from_ref(self);
|
||||
// FIXME(pcwalton): Do this at compile time, not runtime.
|
||||
element.get_uint_attribute(&Atom::from_slice($htmlname), $default)
|
||||
|
@ -64,8 +61,7 @@ macro_rules! make_url_getter(
|
|||
fn $attr(self) -> DOMString {
|
||||
use dom::element::{Element, AttributeHandlers};
|
||||
use dom::bindings::codegen::InheritTypes::ElementCast;
|
||||
#[allow(unused_imports)]
|
||||
use std::ascii::AsciiExt;
|
||||
use string_cache::Atom;
|
||||
let element: JSRef<Element> = ElementCast::from_ref(self);
|
||||
// FIXME(pcwalton): Do this at compile time, not runtime.
|
||||
element.get_url_attribute(&Atom::from_slice($htmlname))
|
||||
|
@ -84,8 +80,7 @@ macro_rules! make_url_or_base_getter(
|
|||
use dom::element::{Element, AttributeHandlers};
|
||||
use dom::bindings::codegen::InheritTypes::ElementCast;
|
||||
use dom::window::WindowHelpers;
|
||||
#[allow(unused_imports)]
|
||||
use std::ascii::AsciiExt;
|
||||
use string_cache::Atom;
|
||||
let element: JSRef<Element> = ElementCast::from_ref(self);
|
||||
let url = element.get_url_attribute(&Atom::from_slice($htmlname));
|
||||
if url.is_empty() {
|
||||
|
@ -107,8 +102,7 @@ macro_rules! make_enumerated_getter(
|
|||
fn $attr(self) -> DOMString {
|
||||
use dom::element::{Element, AttributeHandlers};
|
||||
use dom::bindings::codegen::InheritTypes::ElementCast;
|
||||
#[allow(unused_imports)]
|
||||
use std::ascii::AsciiExt;
|
||||
use string_cache::Atom;
|
||||
use std::borrow::ToOwned;
|
||||
let element: JSRef<Element> = ElementCast::from_ref(self);
|
||||
let val = element.get_string_attribute(&Atom::from_slice($htmlname))
|
||||
|
@ -133,6 +127,7 @@ macro_rules! make_setter(
|
|||
fn $attr(self, value: DOMString) {
|
||||
use dom::element::{Element, AttributeHandlers};
|
||||
use dom::bindings::codegen::InheritTypes::ElementCast;
|
||||
use string_cache::Atom;
|
||||
let element: JSRef<Element> = ElementCast::from_ref(self);
|
||||
// FIXME(pcwalton): Do this at compile time, not at runtime.
|
||||
element.set_string_attribute(&Atom::from_slice($htmlname), value)
|
||||
|
@ -146,6 +141,7 @@ macro_rules! make_bool_setter(
|
|||
fn $attr(self, value: bool) {
|
||||
use dom::element::{Element, AttributeHandlers};
|
||||
use dom::bindings::codegen::InheritTypes::ElementCast;
|
||||
use string_cache::Atom;
|
||||
let element: JSRef<Element> = ElementCast::from_ref(self);
|
||||
// FIXME(pcwalton): Do this at compile time, not at runtime.
|
||||
element.set_bool_attribute(&Atom::from_slice($htmlname), value)
|
||||
|
@ -159,6 +155,7 @@ macro_rules! make_uint_setter(
|
|||
fn $attr(self, value: u32) {
|
||||
use dom::element::{Element, AttributeHandlers};
|
||||
use dom::bindings::codegen::InheritTypes::ElementCast;
|
||||
use string_cache::Atom;
|
||||
let value = if value > 2147483647 {
|
||||
$default
|
||||
} else {
|
||||
|
@ -202,6 +199,20 @@ macro_rules! make_limited_uint_setter(
|
|||
};
|
||||
);
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! make_atomic_setter(
|
||||
( $attr:ident, $htmlname:expr ) => (
|
||||
fn $attr(self, value: DOMString) {
|
||||
use dom::element::{Element, AttributeHandlers};
|
||||
use dom::bindings::codegen::InheritTypes::ElementCast;
|
||||
use string_cache::Atom;
|
||||
let element: JSRef<Element> = ElementCast::from_ref(self);
|
||||
// FIXME(pcwalton): Do this at compile time, not at runtime.
|
||||
element.set_atomic_attribute(&Atom::from_slice($htmlname), value)
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
/// For use on non-jsmanaged types
|
||||
/// Use #[jstraceable] on JS managed types
|
||||
macro_rules! no_jsmanaged_fields(
|
||||
|
|
|
@ -6,11 +6,13 @@ use dom::attr::{Attr, AttrValue};
|
|||
use dom::bindings::codegen::InheritTypes::ElementCast;
|
||||
use dom::bindings::codegen::InheritTypes::HTMLAnchorElementCast;
|
||||
use dom::bindings::codegen::InheritTypes::HTMLAreaElementCast;
|
||||
use dom::bindings::codegen::InheritTypes::HTMLAppletElementCast;
|
||||
use dom::bindings::codegen::InheritTypes::HTMLBodyElementCast;
|
||||
use dom::bindings::codegen::InheritTypes::HTMLButtonElementCast;
|
||||
use dom::bindings::codegen::InheritTypes::HTMLCanvasElementCast;
|
||||
use dom::bindings::codegen::InheritTypes::HTMLElementCast;
|
||||
use dom::bindings::codegen::InheritTypes::HTMLFieldSetElementCast;
|
||||
use dom::bindings::codegen::InheritTypes::HTMLFormElementCast;
|
||||
use dom::bindings::codegen::InheritTypes::HTMLHeadElementCast;
|
||||
use dom::bindings::codegen::InheritTypes::HTMLIFrameElementCast;
|
||||
use dom::bindings::codegen::InheritTypes::HTMLImageElementCast;
|
||||
|
@ -144,6 +146,9 @@ pub fn vtable_for<'a>(node: &'a JSRef<'a, Node>) -> &'a (VirtualMethods + 'a) {
|
|||
let element: &'a JSRef<'a, HTMLAnchorElement> = HTMLAnchorElementCast::to_borrowed_ref(node).unwrap();
|
||||
element as &'a (VirtualMethods + 'a)
|
||||
}
|
||||
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLAppletElement)) => {
|
||||
HTMLAppletElementCast::to_borrowed_ref(node).unwrap() as &'a (VirtualMethods + 'a)
|
||||
}
|
||||
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLAreaElement)) => {
|
||||
let element: &'a JSRef<'a, HTMLAreaElement> = HTMLAreaElementCast::to_borrowed_ref(node).unwrap();
|
||||
element as &'a (VirtualMethods + 'a)
|
||||
|
@ -164,6 +169,9 @@ pub fn vtable_for<'a>(node: &'a JSRef<'a, Node>) -> &'a (VirtualMethods + 'a) {
|
|||
let element: &'a JSRef<'a, HTMLFieldSetElement> = HTMLFieldSetElementCast::to_borrowed_ref(node).unwrap();
|
||||
element as &'a (VirtualMethods + 'a)
|
||||
}
|
||||
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLFormElement)) => {
|
||||
HTMLFormElementCast::to_borrowed_ref(node).unwrap() as &'a (VirtualMethods + 'a)
|
||||
}
|
||||
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLHeadElement)) => {
|
||||
let element: &'a JSRef<'a, HTMLHeadElement> = HTMLHeadElementCast::to_borrowed_ref(node).unwrap();
|
||||
element as &'a (VirtualMethods + 'a)
|
||||
|
|
|
@ -81,7 +81,7 @@ partial /*sealed*/ interface Document {
|
|||
readonly attribute DocumentReadyState readyState;
|
||||
|
||||
// DOM tree accessors
|
||||
// getter object (DOMString name);
|
||||
getter object (DOMString name);
|
||||
attribute DOMString title;
|
||||
[SetterThrows]
|
||||
attribute HTMLElement? body;
|
||||
|
|
|
@ -12,7 +12,7 @@ interface HTMLAppletElement : HTMLElement {
|
|||
// attribute DOMString codeBase;
|
||||
// attribute DOMString height;
|
||||
// attribute unsigned long hspace;
|
||||
// attribute DOMString name;
|
||||
attribute DOMString name;
|
||||
// attribute DOMString _object; // the underscore is not part of the identifier
|
||||
// attribute unsigned long vspace;
|
||||
// attribute DOMString width;
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
[nameditem-01.html]
|
||||
type: testharness
|
||||
[img elements that have a name and id attribute, should be accessible by both values.]
|
||||
expected: FAIL
|
||||
|
|
@ -1,26 +0,0 @@
|
|||
[nameditem-03.html]
|
||||
type: testharness
|
||||
[If there is one applet, it should be returned (name)]
|
||||
expected: FAIL
|
||||
|
||||
[If there are two applets, a collection should be returned. (name)]
|
||||
expected: FAIL
|
||||
|
||||
[If there is one applet, it should be returned (id)]
|
||||
expected: FAIL
|
||||
|
||||
[If there are two applets, a collection should be returned. (id)]
|
||||
expected: FAIL
|
||||
|
||||
[If there are two applets, a collection should be returned. (name and id)]
|
||||
expected: FAIL
|
||||
|
||||
[If there are two applets, a collection should be returned. (id and name)]
|
||||
expected: FAIL
|
||||
|
||||
[A name shouldn't affect getting an applet by id]
|
||||
expected: FAIL
|
||||
|
||||
[An id shouldn't affect getting an applet by name]
|
||||
expected: FAIL
|
||||
|
|
@ -1,17 +0,0 @@
|
|||
[nameditem-04.html]
|
||||
type: testharness
|
||||
[If there is one form, it should be returned (name)]
|
||||
expected: FAIL
|
||||
|
||||
[If there are two forms, a collection should be returned. (name)]
|
||||
expected: FAIL
|
||||
|
||||
[If there are two forms, a collection should be returned. (name and id)]
|
||||
expected: FAIL
|
||||
|
||||
[If there are two forms, a collection should be returned. (id and name)]
|
||||
expected: FAIL
|
||||
|
||||
[An id shouldn't affect getting an form by name]
|
||||
expected: FAIL
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
[nameditem-06.html]
|
||||
type: testharness
|
||||
[If there is one img, it should be returned (name)]
|
||||
expected: FAIL
|
||||
|
||||
[If there are two imgs, a collection should be returned. (name)]
|
||||
expected: FAIL
|
||||
|
||||
[If there are two imgs, the one with a name should be returned. (name and id)]
|
||||
expected: FAIL
|
||||
|
||||
[If there are two imgs, the one with a name should be returned. (id and name)]
|
||||
expected: FAIL
|
||||
|
||||
[A name should affect getting an img by id]
|
||||
expected: FAIL
|
||||
|
||||
[An id shouldn't affect getting an img by name]
|
||||
expected: FAIL
|
||||
|
|
@ -8967,9 +8967,6 @@
|
|||
[HTMLAppletElement interface: attribute hspace]
|
||||
expected: FAIL
|
||||
|
||||
[HTMLAppletElement interface: attribute name]
|
||||
expected: FAIL
|
||||
|
||||
[HTMLAppletElement interface: attribute object]
|
||||
expected: FAIL
|
||||
|
||||
|
@ -9000,9 +8997,6 @@
|
|||
[HTMLAppletElement interface: document.createElement("applet") must inherit property "hspace" with the proper type (6)]
|
||||
expected: FAIL
|
||||
|
||||
[HTMLAppletElement interface: document.createElement("applet") must inherit property "name" with the proper type (7)]
|
||||
expected: FAIL
|
||||
|
||||
[HTMLAppletElement interface: document.createElement("applet") must inherit property "object" with the proper type (8)]
|
||||
expected: FAIL
|
||||
|
||||
|
|
|
@ -1452,135 +1452,6 @@
|
|||
[applet.hspace: IDL set to "-0" followed by IDL get]
|
||||
expected: FAIL
|
||||
|
||||
[applet.name: typeof IDL attribute]
|
||||
expected: FAIL
|
||||
|
||||
[applet.name: IDL get with DOM attribute unset]
|
||||
expected: FAIL
|
||||
|
||||
[applet.name: setAttribute() to "" followed by IDL get]
|
||||
expected: FAIL
|
||||
|
||||
[applet.name: setAttribute() to " \\0\\x01\\x02\\x03\\x04\\x05\\x06\\x07 \\b\\t\\n\\v\\f\\r\\x0e\\x0f \\x10\\x11\\x12\\x13\\x14\\x15\\x16\\x17 \\x18\\x19\\x1a\\x1b\\x1c\\x1d\\x1e\\x1f foo " followed by IDL get]
|
||||
expected: FAIL
|
||||
|
||||
[applet.name: setAttribute() to undefined followed by IDL get]
|
||||
expected: FAIL
|
||||
|
||||
[applet.name: setAttribute() to 7 followed by IDL get]
|
||||
expected: FAIL
|
||||
|
||||
[applet.name: setAttribute() to 1.5 followed by IDL get]
|
||||
expected: FAIL
|
||||
|
||||
[applet.name: setAttribute() to true followed by IDL get]
|
||||
expected: FAIL
|
||||
|
||||
[applet.name: setAttribute() to false followed by IDL get]
|
||||
expected: FAIL
|
||||
|
||||
[applet.name: setAttribute() to object "[object Object\]" followed by IDL get]
|
||||
expected: FAIL
|
||||
|
||||
[applet.name: setAttribute() to NaN followed by IDL get]
|
||||
expected: FAIL
|
||||
|
||||
[applet.name: setAttribute() to Infinity followed by IDL get]
|
||||
expected: FAIL
|
||||
|
||||
[applet.name: setAttribute() to -Infinity followed by IDL get]
|
||||
expected: FAIL
|
||||
|
||||
[applet.name: setAttribute() to "\\0" followed by IDL get]
|
||||
expected: FAIL
|
||||
|
||||
[applet.name: setAttribute() to null followed by IDL get]
|
||||
expected: FAIL
|
||||
|
||||
[applet.name: setAttribute() to object "test-toString" followed by IDL get]
|
||||
expected: FAIL
|
||||
|
||||
[applet.name: setAttribute() to object "test-valueOf" followed by IDL get]
|
||||
expected: FAIL
|
||||
|
||||
[applet.name: IDL set to "" followed by getAttribute()]
|
||||
expected: FAIL
|
||||
|
||||
[applet.name: IDL set to " \\0\\x01\\x02\\x03\\x04\\x05\\x06\\x07 \\b\\t\\n\\v\\f\\r\\x0e\\x0f \\x10\\x11\\x12\\x13\\x14\\x15\\x16\\x17 \\x18\\x19\\x1a\\x1b\\x1c\\x1d\\x1e\\x1f foo " followed by getAttribute()]
|
||||
expected: FAIL
|
||||
|
||||
[applet.name: IDL set to undefined followed by getAttribute()]
|
||||
expected: FAIL
|
||||
|
||||
[applet.name: IDL set to undefined followed by IDL get]
|
||||
expected: FAIL
|
||||
|
||||
[applet.name: IDL set to 7 followed by getAttribute()]
|
||||
expected: FAIL
|
||||
|
||||
[applet.name: IDL set to 7 followed by IDL get]
|
||||
expected: FAIL
|
||||
|
||||
[applet.name: IDL set to 1.5 followed by getAttribute()]
|
||||
expected: FAIL
|
||||
|
||||
[applet.name: IDL set to 1.5 followed by IDL get]
|
||||
expected: FAIL
|
||||
|
||||
[applet.name: IDL set to true followed by getAttribute()]
|
||||
expected: FAIL
|
||||
|
||||
[applet.name: IDL set to true followed by IDL get]
|
||||
expected: FAIL
|
||||
|
||||
[applet.name: IDL set to false followed by getAttribute()]
|
||||
expected: FAIL
|
||||
|
||||
[applet.name: IDL set to false followed by IDL get]
|
||||
expected: FAIL
|
||||
|
||||
[applet.name: IDL set to object "[object Object\]" followed by getAttribute()]
|
||||
expected: FAIL
|
||||
|
||||
[applet.name: IDL set to object "[object Object\]" followed by IDL get]
|
||||
expected: FAIL
|
||||
|
||||
[applet.name: IDL set to NaN followed by getAttribute()]
|
||||
expected: FAIL
|
||||
|
||||
[applet.name: IDL set to NaN followed by IDL get]
|
||||
expected: FAIL
|
||||
|
||||
[applet.name: IDL set to Infinity followed by getAttribute()]
|
||||
expected: FAIL
|
||||
|
||||
[applet.name: IDL set to Infinity followed by IDL get]
|
||||
expected: FAIL
|
||||
|
||||
[applet.name: IDL set to -Infinity followed by getAttribute()]
|
||||
expected: FAIL
|
||||
|
||||
[applet.name: IDL set to -Infinity followed by IDL get]
|
||||
expected: FAIL
|
||||
|
||||
[applet.name: IDL set to "\\0" followed by getAttribute()]
|
||||
expected: FAIL
|
||||
|
||||
[applet.name: IDL set to null followed by getAttribute()]
|
||||
expected: FAIL
|
||||
|
||||
[applet.name: IDL set to null followed by IDL get]
|
||||
expected: FAIL
|
||||
|
||||
[applet.name: IDL set to object "test-toString" followed by getAttribute()]
|
||||
expected: FAIL
|
||||
|
||||
[applet.name: IDL set to object "test-toString" followed by IDL get]
|
||||
expected: FAIL
|
||||
|
||||
[applet.name: IDL set to object "test-valueOf" followed by IDL get]
|
||||
expected: FAIL
|
||||
|
||||
[applet.object: typeof IDL attribute]
|
||||
expected: FAIL
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue