<?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>16425</bug_id>
          
          <creation_ts>2012-03-18 23:08:22 +0000</creation_ts>
          <short_desc>MutationObserver::observe/disconnect should return mutationobserver itself</short_desc>
          <delta_ts>2012-11-22 21:55:01 +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>Linux</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>WONTFIX</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="Olli Pettay">bugs</reporter>
          <assigned_to name="Anne">annevk</assigned_to>
          <cc>jonas</cc>
    
    <cc>mike</cc>
    
    <cc>Ms2ger</cc>
    
    <cc>rafaelw</cc>
    
    <cc>waldron.rick</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>65718</commentid>
    <comment_count>0</comment_count>
    <who name="Olli Pettay">bugs</who>
    <bug_when>2012-03-18 23:08:22 +0000</bug_when>
    <thetext>This was discussed and somewhat agreed end of September.
Allows one to do
observer.disconnect()
        .observe(node1, {...})
        .observe(node2, {...});</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>65720</commentid>
    <comment_count>1</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2012-03-18 23:27:00 +0000</bug_when>
    <thetext>We have implemented this pattern in no API whatsoever to date. It was a conscious omission.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>65721</commentid>
    <comment_count>2</comment_count>
    <who name="Olli Pettay">bugs</who>
    <bug_when>2012-03-18 23:28:51 +0000</bug_when>
    <thetext>Ok. I don&apos;t care too much. 
I personally don&apos;t like that coding style at all
(but one doesn&apos;t need to use that ugly style.)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>65769</commentid>
    <comment_count>3</comment_count>
    <who name="Jonas Sicking (Not reading bugmail)">jonas</who>
    <bug_when>2012-03-19 19:33:43 +0000</bug_when>
    <thetext>Anne: &quot;we haven&apos;t used this pattern anywhere else&quot; is a terrible reason. Up until recently we also had never used dictionaries.

I hope that there&apos;s a better reason that than, such as that it fosters bad development practices, that it&apos;s bad for performance, or that it can result in buggy code?

Reopening since so far no good reason has been made.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>65778</commentid>
    <comment_count>4</comment_count>
    <who name="Ms2ger">Ms2ger</who>
    <bug_when>2012-03-19 21:30:36 +0000</bug_when>
    <thetext>AIUI, the plan was to wait for ES to provide something to address this pattern for *all* APIs, rather than trying to implement it just for a couple of new APIs. Returning self also prevents us from returning something meaningful (even though we currently don&apos;t in this case).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>65781</commentid>
    <comment_count>5</comment_count>
    <who name="Jonas Sicking (Not reading bugmail)">jonas</who>
    <bug_when>2012-03-19 22:10:08 +0000</bug_when>
    <thetext>What would this look like to be API-wide? Are we talking about something like the now-defunct &apos;with&apos; operator? Has anyone check with TC39 if that is in the stars at all before we rely on them?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>65783</commentid>
    <comment_count>6</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2012-03-19 23:35:54 +0000</bug_when>
    <thetext>You generally need a good reason for doing something, not for not doing it.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>65785</commentid>
    <comment_count>7</comment_count>
    <who name="Jonas Sicking (Not reading bugmail)">jonas</who>
    <bug_when>2012-03-20 00:34:59 +0000</bug_when>
    <thetext>The good reason would be that it makes it much easier to observe several parts of the DOM.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>65786</commentid>
    <comment_count>8</comment_count>
    <who name="Olli Pettay">bugs</who>
    <bug_when>2012-03-20 00:51:13 +0000</bug_when>
    <thetext>&quot;much&quot; is quite strong word.

var o = new MutationObserver(callback);
o.observe(node1, {...});
o.observe(node2, {...});
o.observe(node3, {...});

is not much longer than
var o = new MutationObserver(callback);
o.observe(node1, {...})
 .observe(node2, {...})
 .observe(node3, {...});</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>65787</commentid>
    <comment_count>9</comment_count>
    <who name="Jonas Sicking (Not reading bugmail)">jonas</who>
    <bug_when>2012-03-20 00:54:50 +0000</bug_when>
    <thetext>Though it means that you can avoid the temporary:

(new MutationObserver(callback))
  .observe(node1, {...})
  .observe(node2, {...})
  .observe(node3, {...});</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>78611</commentid>
    <comment_count>10</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2012-11-21 21:28:26 +0000</bug_when>
    <thetext>Once ECMAScript adopts this pattern we can consider it. (See also bug 13681 comment 5.)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>78612</commentid>
    <comment_count>11</comment_count>
    <who name="Rafael Weinstein">rafaelw</who>
    <bug_when>2012-11-21 21:57:41 +0000</bug_when>
    <thetext>What would &quot;once&quot; look like? Object.freeze/preventExtensions/etc... are already spec&apos;d to return the object.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>78613</commentid>
    <comment_count>12</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2012-11-21 22:17:19 +0000</bug_when>
    <thetext>Well, e.g. Map.set() returns undefined. Maybe that&apos;s what design by committee looks like?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>78614</commentid>
    <comment_count>13</comment_count>
    <who name="Rafael Weinstein">rafaelw</who>
    <bug_when>2012-11-21 22:21:47 +0000</bug_when>
    <thetext>We recently changed the Object.observe/unobserve spec calls to return object, for consistency with Object.freeze/etc... I think there&apos;s a clear move in that direction.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>78615</commentid>
    <comment_count>14</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2012-11-21 22:27:57 +0000</bug_when>
    <thetext>Okay, raised: http://lists.w3.org/Archives/Public/public-script-coord/2012OctDec/0164.html</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>78666</commentid>
    <comment_count>15</comment_count>
    <who name="Rick Waldron">waldron.rick</who>
    <bug_when>2012-11-22 21:55:01 +0000</bug_when>
    <thetext>FWIW, the new Object.observe API has recently been updated to return the target object.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>