diff --git a/dom.bs b/dom.bs index 5266d1bbe..e337fd35a 100644 --- a/dom.bs +++ b/dom.bs @@ -815,7 +815,7 @@ method steps are:
  1. If this's dispatch flag is set, then return. -

  2. Initialize this with type, bubbles, and +

  3. Initialize this with type, bubbles, and cancelable.

@@ -886,7 +886,7 @@ method steps are:
  1. If this's dispatch flag is set, then return. -

  2. Initialize this with type, bubbles, and +

  3. Initialize this with type, bubbles, and cancelable.

  4. Set this's {{CustomEvent/detail}} attribute to detail. @@ -5997,19 +5997,13 @@ and node document is this. method steps are:

      -
    1. If target does not match the - [=XML/Name=] production, - then throw an "{{InvalidCharacterError!!exception}}" {{DOMException}}. +
    2. Let pi be a new {{ProcessingInstruction}} + node, with node document set to this. -

    3. If data contains the string - "?>", then throw an - "{{InvalidCharacterError!!exception}}" {{DOMException}}. +
    4. Initialize pi with target and + data. -

    5. Return a new {{ProcessingInstruction}} - node, with - target set to target, - data set to data, and - node document set to this. +
    6. Return pi.


    @@ -8221,7 +8215,8 @@ string called data.

    To replace data of a node node -with an integer offset, integer count, and string data: +with an integer offset, integer count, string data, and an optional +boolean piAttributesAlreadyUpdated (default false):

    1. Let length be node's length. @@ -8263,6 +8258,10 @@ with an integer offset, integer count, and string dat end offset by data's length and decrease it by count. +

    2. If node is a {{ProcessingInstruction}} node and + piAttributesAlreadyUpdated is false, then update attributes from data for + node. +

    3. If node's parent is non-null, then run the children changed steps for node's parent.

    @@ -8518,17 +8517,259 @@ interface CDATASection : Text {
     [Exposed=Window]
     interface ProcessingInstruction : CharacterData {
    +  constructor(DOMString target, optional DOMString data = "");
    +
       readonly attribute DOMString target;
    +
    +  boolean hasAttributes();
    +  sequence<DOMString> getAttributeNames();
    +  DOMString? getAttribute(DOMString name);
    +  undefined setAttribute(DOMString name, DOMString value);
    +  undefined removeAttribute(DOMString name);
    +  boolean toggleAttribute(DOMString name, optional boolean force);
    +  boolean hasAttribute(DOMString name);
     };
    +
    +
    pi = new ProcessingInstruction(target [, data = ""]) +
    Returns a new {{ProcessingInstruction}} node whose + target is target and + data is data. + +
    pi . {{ProcessingInstruction/target}} +
    Returns the target. + +
    pi . hasAttributes() +

    Returns true if pi has attributes; otherwise false. + +

    pi . getAttributeNames() +

    Returns the names of all of pi's attributes. Cannot contain duplicates. + +

    pi . getAttribute(name) +

    Returns the value of pi's attribute named name, and null if there is + no such attribute. + +

    pi . setAttribute(name, value) +

    Sets pi's attribute named name to value. + +

    pi . removeAttribute(name) +

    Removes pi's attribute named name. + +

    pi . toggleAttribute(name [, force]) +
    +

    If force is not given, "toggles" name, removing it if it is + present and adding it if it is not present. If force is true, adds + name. If force is false, removes name. + +

    Returns true if name is now present; otherwise false. + +

    pi . hasAttribute(name) +

    Returns true if pi has an attribute named name; otherwise false. +

    + +
    +

    The +new ProcessingInstruction(target, data) +constructor steps are: + +

      +
    1. Set this's node document to current global object's + associated Document. + +

    2. Initialize this with target and + data. + +

    3. Update attributes from data for this. +

    +
    +

    {{ProcessingInstruction}} nodes have an associated target. +

    {{ProcessingInstruction}} nodes have an associated +attribute map, which is a +map, initially empty. +

    The target getter steps are to return this's target.

    +
    +

    The hasAttributes() method steps are to +return false if this's attribute map +is empty; otherwise true. +

    + +
    +

    The getAttributeNames() method steps +are to return the result of getting the keys of this's +attribute map. +

    + +
    +

    The getAttribute(name) method +steps are: + +

      +
    1. Set name to name in ASCII lowercase. + +

    2. Return this's attribute map[name] + with default null. +

    +
    + +
    +

    The +setAttribute(name, value) +method steps are: + +

      +
    1. If name is not a valid attribute local name, then throw an + "{{InvalidCharacterError!!exception}}" {{DOMException}}. + +

    2. Set name to name in ASCII lowercase. + +

    3. Set this's + attribute map[name] to value. + +

    4. Update data from attributes for this. +

    +
    + +
    +

    The removeAttribute(name) +method steps are: + +

      +
    1. Set name to name in ASCII lowercase. + +

    2. Remove this's + attribute map[name]. + +

    3. Update data from attributes for this. +

    +
    + +
    +

    The +toggleAttribute(name, force) +method steps are: + +

      +
    1. If name is not a valid attribute local name, then throw an + "{{InvalidCharacterError!!exception}}" {{DOMException}}. + +

    2. Set name to name in ASCII lowercase. + +

    3. Let attributes be this's attribute map. + +

    4. +

      If attributes[name] does not exist: + +

        +
      1. If force is not given or is true, set attributes[name] + to the empty string, update data from attributes for this, and then return true. + +

      2. Return false. +

      + +
    5. Otherwise, if force is not given or is false, remove + attributes[name], update data from attributes for this, and + then return false. + +

    6. Return true. +

    +
    + +
    +

    The hasAttribute(name) +method steps are: + +

      +
    1. Set name to name in ASCII lowercase. + +

    2. Return true if this's attribute map[name] + exists; otherwise false. +

    +
    + +
    +

    To initialize a +{{ProcessingInstruction}} node pi with target and +data: + +

      +
    1. If target does not match the [=XML/Name=] production, then + throw an "{{InvalidCharacterError!!exception}}" {{DOMException}}. + + +

    2. If data contains the string "?>", then throw an + "{{InvalidCharacterError!!exception}}" {{DOMException}}. + +

    3. Set pi's target to target. + +

    4. Set pi's data to data. + +

    5. Update attributes from data for pi. +

    +
    + +
    +

    To update attributes from data for a {{ProcessingInstruction}} node +pi: + +

      +
    1. Clear pi's attribute map. + +

    2. Let document be a new {{Document}} node whose type is + "html". + +

    3. Let html be the concatenation of "<html ", + pi's data, and ">". + +

    4. Parse HTML from a string + given document and html. + +

    5. For each attribute of document's + document element's attribute list, set pi's + attribute map[attribute's local name] + to attribute's value. +

    +
    + +
    +

    To update data from attributes for a {{ProcessingInstruction}} node +pi: + +

      +
    1. Let data be the empty string. + +

    2. +

      For each namevalue of pi's + attribute map: + +

        +
      1. If data is not the empty string, then append U+0020 SPACE to data. + +

      2. Append name to data. + +

      3. Append U+003D (=) to data. + +

      4. Append U+0022 (") to data. + +

      5. Append the result of + escaping a string given + value to data. + +

      6. Append U+0022 (") to data. +

      + +
    3. Replace data of pi with 0, pi's length, + data, and true. +

    +
    +

    Interface {{Comment}}