Skip to content

Missing DOM features project

Josh Matthews edited this page Oct 16, 2019 · 4 revisions

Implement missing DOM features

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)

Useful references:

Initial steps:

Subsequent steps:

  • uncomment the named getter from HTMLFormElement.webidl
  • add the missing NamedGetter and SupportedPropertyNames methods to HTMLFormElement
  • implement SupportedPropertyNames according to the specification:
    • create an enum to represent the id, name, and past states for the sourced names
    • create a vector of (SourcedName, DomRoot<HTMLElement>) by iterating over self.controls and checking the element type and calling methods like HTMLElement::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
  • implement a live NodeList for form element collections:
    • create an enum representing the kind of live RadioNodeList - Listed or Img
    • add a FormControls variant to NodeListType which contains a Dom<HTMLFormElement>, the new enum, and a DOMString
    • add a method to HTMLFormElement that returns a Ref<Vec<Dom<Element>>> and exposes its self.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
  • 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
  • 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
Clone this wiki locally