<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://www.w3.org/Bugs/Public/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4"
          urlbase="https://www.w3.org/Bugs/Public/"
          
          maintainer="sysbot+bugzilla@w3.org"
>

    <bug>
          <bug_id>23189</bug_id>
          
          <creation_ts>2013-09-09 19:22:51 +0000</creation_ts>
          <short_desc>Better defaults for #observe options</short_desc>
          <delta_ts>2013-09-10 12:10:07 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebAppsWG</product>
          <component>DOM</component>
          <version>unspecified</version>
          <rep_platform>PC</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Robin Berjon">robin</reporter>
          <assigned_to name="Anne">annevk</assigned_to>
          <cc>bugs</cc>
    
    <cc>jonas</cc>
    
    <cc>mike</cc>
    
    <cc>www-dom</cc>
          
          <qa_contact>public-webapps-bugzilla</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>93164</commentid>
    <comment_count>0</comment_count>
    <who name="Robin Berjon">robin</who>
    <bug_when>2013-09-09 19:22:51 +0000</bug_when>
    <thetext>http://dom.spec.whatwg.org/#interface-mutationobserver

[[
If attributeOldValue is true and attributes is not true, throw a &quot;SyntaxError&quot;.

If attributeFilter is a non-empty array and attributes is not true, throw a &quot;SyntaxError&quot;.

If characterDataOldValue is true and characterData is not true, throw a &quot;SyntaxError&quot;. 
]]

Why not consider that attributes is automatically set to true for the first two, and likewise characterData for the third? It&apos;s certainly what the developer meant, and it&apos;s less typing.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>93166</commentid>
    <comment_count>1</comment_count>
    <who name="Jonas Sicking (Not reading bugmail)">jonas</who>
    <bug_when>2013-09-09 21:11:47 +0000</bug_when>
    <thetext>I do think we want

{ attributes: false, attributeOldValue: true }
and
{ characterData: false, characterOldData: true }

to both throw an exception. What we could do is to make the default value of attributes/characterData depend on the value of the *Old* properties though, rather than being statically set in the WebIDL.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>93180</commentid>
    <comment_count>2</comment_count>
    <who name="Olli Pettay">bugs</who>
    <bug_when>2013-09-09 23:27:29 +0000</bug_when>
    <thetext>Yeah, if attributes is not set and attributeOldValue or attributeFilter is set
(true or false and any array), then attributes becomes implicitly true.
Same with characterData</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>93192</commentid>
    <comment_count>3</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2013-09-10 11:04:27 +0000</bug_when>
    <thetext>So a new model would look like:

dictionary MutationObserverInit {
  boolean childList = false;
  boolean attributes;
  boolean characterData;
  boolean subtree = false;
  boolean attributeOldValue = false;
  boolean characterDataOldValue = false;
  sequence&lt;DOMString&gt; attributeFilter;
};

* If options&apos; attributeOldValue is true and options&apos; attributes is omitted, set options&apos; attributes to true.

* If options&apos; attributeFilter is present and options&apos; attributes is omitted, set
options&apos; attributes to true.

* If options&apos; characterDataOldValue is true and options&apos; characterData is omitted, set options&apos; characterData to true.

* If none of options&apos; childList, attributes, and characterData is true, throw a TypeError.

* If attributeOldValue is true and attributes is false, throw a TypeError.

* If attributeFilter is a non-empty array and attributes is false, throw a TypeError.

* If characterDataOldValue is true and characterData is false, throw a TypeError.

(I also changed the exception to a JavaScript TypeError in our quest to more closely integrate with JavaScript.)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>93196</commentid>
    <comment_count>4</comment_count>
    <who name="Robin Berjon">robin</who>
    <bug_when>2013-09-10 12:05:05 +0000</bug_when>
    <thetext>That LGTM.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>93197</commentid>
    <comment_count>5</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2013-09-10 12:10:07 +0000</bug_when>
    <thetext>I made a few more tweaks relative to comment 3.

Only check for attributeFilter being present, rather than non-empty. Not have default values at all for the *OldValue members and check for their presence rather than checking if they are true when setting attributes/characterData to true.

https://github.com/whatwg/dom/commit/a770b11981f4c147f98753cf726e44b14d17affc</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>