Add/update comments with links to spec

Extracted out of #5649

* add more hyperlinks to associated specification for structs/methods
* follow redirects and update links
* replace broken links
* removal of WHATWG multipage page name since the page name is not
  guaranteed to be stable
This commit is contained in:
Corey Farwell 2015-04-11 11:35:40 -07:00
parent 7f422e2076
commit cc4a64e1fe
19 changed files with 112 additions and 35 deletions

View file

@ -497,7 +497,7 @@ impl<'a> ElementHelpers<'a> for JSRef<'a, Element> {
}
match self.local_name.as_slice() {
/* List of void elements from
https://www.whatwg.org/specs/web-apps/current-work/multipage/the-end.html#html-fragment-serialization-algorithm */
https://html.spec.whatwg.org/multipage/#html-fragment-serialisation-algorithm */
"area" | "base" | "basefont" | "bgsound" | "br" | "col" | "embed" |
"frame" | "hr" | "img" | "input" | "keygen" | "link" | "menuitem" |
"meta" | "param" | "source" | "track" | "wbr" => true,
@ -602,10 +602,10 @@ impl<'a> ElementHelpers<'a> for JSRef<'a, Element> {
}
pub trait FocusElementHelpers {
/// https://html.spec.whatwg.org/multipage/interaction.html#focusable-area
/// https://html.spec.whatwg.org/multipage/#focusable-area
fn is_focusable_area(self) -> bool;
/// https://html.spec.whatwg.org/multipage/scripting.html#concept-element-disabled
/// https://html.spec.whatwg.org/multipage/#concept-element-disabled
fn is_actually_disabled(self) -> bool;
}
@ -616,7 +616,7 @@ impl<'a> FocusElementHelpers for JSRef<'a, Element> {
}
// TODO: Check whether the element is being rendered (i.e. not hidden).
// TODO: Check the tabindex focus flag.
// https://html.spec.whatwg.org/multipage/interaction.html#specially-focusable
// https://html.spec.whatwg.org/multipage/#specially-focusable
let node: JSRef<Node> = NodeCast::from_ref(self);
match node.type_id() {
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLAnchorElement)) |
@ -1481,8 +1481,7 @@ impl<'a> style::node::TElement<'a> for JSRef<'a, Element> {
// FIXME: This is HTML only.
let node: JSRef<Node> = NodeCast::from_ref(self);
match node.type_id() {
// https://www.whatwg.org/specs/web-apps/current-work/multipage/selectors.html#
// selector-link
// https://html.spec.whatwg.org/multipage/#selector-link
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLAnchorElement)) |
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLAreaElement)) |
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLLinkElement)) => self.get_attr(&ns!(""), &atom!("href")),
@ -1514,7 +1513,7 @@ impl<'a> style::node::TElement<'a> for JSRef<'a, Element> {
fn get_focus_state(self) -> bool {
// TODO: Also check whether the top-level browsing context has the system focus,
// and whether this element is a browsing context container.
// https://html.spec.whatwg.org/multipage/scripting.html#selector-focus
// https://html.spec.whatwg.org/multipage/#selector-focus
let node: JSRef<Node> = NodeCast::from_ref(self);
node.get_focus_state()
}
@ -1629,7 +1628,7 @@ impl<'a> ActivationElementHelpers<'a> for JSRef<'a, Element> {
node.set_flag(CLICK_IN_PROGRESS, click)
}
// https://html.spec.whatwg.org/multipage/interaction.html#nearest-activatable-element
// https://html.spec.whatwg.org/multipage/#nearest-activatable-element
fn nearest_activable_element(self) -> Option<Temporary<Element>> {
match self.as_maybe_activatable() {
Some(el) => Some(Temporary::from_rooted(el.as_element().root().r())),
@ -1650,7 +1649,7 @@ impl<'a> ActivationElementHelpers<'a> for JSRef<'a, Element> {
/// Please call this method *only* for real click events
///
/// https://html.spec.whatwg.org/multipage/interaction.html#run-authentic-click-activation-steps
/// https://html.spec.whatwg.org/multipage/#run-authentic-click-activation-steps
///
/// Use an element's synthetic click activation (or handle_event) for any script-triggered clicks.
/// If the spec says otherwise, check with Manishearth first