Missing DOM features project
Josh Matthews edited this page Oct 16, 2019
·
4 revisions
Background information: The HTML specification is large, and major browsers attempt to implement as much of it as possible. Servo is a new, experimental browser that supports many parts of the specification, but is still missing some pieces entirely. The goal of this project is to implement two of these missing pieces to improve our compatibility with existing web content and improve our automated test coverage for tests that rely on these features.
Tracking issue: (please ask questions in these issues)
- https://github.com/servo/servo/issues/4767 (srcdoc iframes)
- https://github.com/servo/servo/issues/16479 (named form getter)
Useful references:
- Guide to getting Servo building
- Documentation for types and modules inside Servo
Initial steps:
- email the mozilla.dev.servo mailing list (be sure to subscribe to it first!) introducing your group and asking any necessary questions
- uncomment the srcdoc WebIDL attribute, and implement the attribute getter.
- add a field to LoadData for storing the srcdoc contents when loading a srcdoc iframe
- add a method to
script_thread.rs
(using start_page_load_about_blank as a model) which loads the specialabout:srcdoc
URL per the specification and takes the srcdoc contents as an argument - call this new method from handle_new_layout when it's detected that a srcdoc iframe is being loaded
- in process_the_iframe_attributes, implement the srcdoc specification so that the resulting LoadData initiates a srcdoc load
- in attribute_mutated, ensure that changing the
srcdoc
attribute of an iframe element follows the specification - Verify that
./mach test-wpt tests/web-platform-tests/html/semantics/embedded-content/the-iframe-element/srcdoc_process_attributes.html
is passing.
Subsequent steps:
- uncomment the named getter from HTMLFormElement.webidl
- add the missing
NamedGetter
andSupportedPropertyNames
methods to HTMLFormElement - implement
SupportedPropertyNames
according to the specification:- create an enum to represent the
id
,name,
andpast
states for the sourced names - create a vector of
(SourcedName, DomRoot<HTMLElement>)
by iterating overself.controls
and checking the element type and calling methods likeHTMLElement::is_listed_element
- sort and filter elements from the vector as described in the spec using
Node::CompareDocumentPosition
- return a new vector of unique names
- create an enum to represent the
- implement a live NodeList for form element collections:
- create an enum representing the kind of live RadioNodeList -
Listed
orImg
- add a
FormControls
variant to NodeListType which contains aDom<HTMLFormElement>
, the new enum, and a DOMString - add a method to
HTMLFormElement
that returns aRef<Vec<Dom<Element>>>
and exposes itsself.controls
- implement the NodeList API for the new NodeListType variant using the new HTMLFormElement API to iterate over and filter matching elements from the form element's controls
- create an enum representing the kind of live RadioNodeList -
- implement
NamedGetter
according to [the specification]:- add a
past names map
member (HashMap<DOMString, Dom<HTMLElement>
) to HTMLFormElement - create RadioNodeList objects according to the specification
- update the past names map according to the specification
- add a
- verify the results of the tests:
./mach test-wpt tests/wpt/web-platform-tests/html/semantics/forms/the-form-element/form-elements-nameditem-01.html
./mach test-wpt tests/wpt/web-platform-tests/html/semantics/forms/the-form-element/form-elements-nameditem-02.html
./mach test-wpt tests/wpt/web-platform-tests/html/semantics/forms/the-form-element/form-nameditem.html