<?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>26863</bug_id>
          
          <creation_ts>2014-09-19 18:39:58 +0000</creation_ts>
          <short_desc>invoking filter</short_desc>
          <delta_ts>2014-09-20 10:41:41 +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>FIXED</resolution>
          
          
          <bug_file_loc>https://dom.spec.whatwg.org/#concept-node-filter</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="Philippe Le Hegaret">plh</reporter>
          <assigned_to name="Anne">annevk</assigned_to>
          <cc>bzbarsky</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>111823</commentid>
    <comment_count>0</comment_count>
    <who name="Philippe Le Hegaret">plh</who>
    <bug_when>2014-09-19 18:39:58 +0000</bug_when>
    <thetext>What does &quot;invoking filter&quot; mean when presented with the following one:

var filter = function() { return FILTER_ACCEPT; };
    filter.acceptNode = function(node) { return FILTER_SKIP; };</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>111825</commentid>
    <comment_count>1</comment_count>
    <who name="Boris Zbarsky">bzbarsky</who>
    <bug_when>2014-09-19 18:47:43 +0000</bug_when>
    <thetext>There should be no &quot;invoking filter&quot;.  There should just be calling of the acceptNode method on filter....</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>111843</commentid>
    <comment_count>2</comment_count>
    <who name="Philippe Le Hegaret">plh</who>
    <bug_when>2014-09-19 20:21:10 +0000</bug_when>
    <thetext>Implementations will either take a Function or an Object with the acceptNode function for the filter parameter, so it&apos;s not just about calling the acceptNode method. The spec has a note for that effect already. However, when both are offered, implementations will use the function directly (ie the filter will return FILTER_ACCEPT in this case) and acceptNode will not get called. The spec is however silent on which one to choose.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>111874</commentid>
    <comment_count>3</comment_count>
    <who name="Boris Zbarsky">bzbarsky</who>
    <bug_when>2014-09-20 01:13:17 +0000</bug_when>
    <thetext>No, implementations take an instance of the NodeFilter callback interface, which always has an acceptNode method.

This is a single-operation callback interface, which means you can pass in a function as an implementation of it in the ECMAScript binding.

Then when acceptNode is called you end up at http://heycam.github.io/webidl/#es-user-objects step 1 substep 3, discover that IsCallable(O) is true, and set X to O.  Then in step 1 substep 11 subsubstep 1 the [[Call]] of X is invoked, which calls the function in question.

So in particular, in the case of comment 0 the filter will return FILTER_ACCEPT, and this is perfectly well specified by Web IDL as long as the DOM spec says to call the acceptNode method on the callback interface object.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>111878</commentid>
    <comment_count>4</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2014-09-20 08:18:28 +0000</bug_when>
    <thetext>In the same way as https://dom.spec.whatwg.org/#concept-event-listener-invoke I guess.

(I wish bug 25138 and especially bug 17713 were fixed already.)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>111882</commentid>
    <comment_count>5</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2014-09-20 10:41:41 +0000</bug_when>
    <thetext>https://github.com/whatwg/dom/commit/c8ef4c9079d2f585ec803c00a8ab97999ef2f4c4</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>