<?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>24028</bug_id>
          
          <creation_ts>2013-12-07 23:22:22 +0000</creation_ts>
          <short_desc>Element.matches(&quot;!invalid!&quot;) should throw DOMException &quot;SyntaxError&quot;, not JavaScript TypeError</short_desc>
          <delta_ts>2014-06-03 10:27:58 +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>
          <dependson>23367</dependson>
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Philip Jägenstedt">philipj</reporter>
          <assigned_to name="Anne">annevk</assigned_to>
          <cc>crimsteam</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>97284</commentid>
    <comment_count>0</comment_count>
    <who name="Philip Jägenstedt">philipj</who>
    <bug_when>2013-12-07 23:22:22 +0000</bug_when>
    <thetext>http://dom.spec.whatwg.org/#evaluate-a-selectors-string

All tested *MatchesSelector() implementations throw a SyntaxError when parsing fails, but the spec requires TypeError.

SyntaxError seems more reasonable here, so change the spec to match reality?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>97326</commentid>
    <comment_count>1</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2013-12-09 14:41:27 +0000</bug_when>
    <thetext>The reason behind using TypeError is that using DOMException is not actually favored by TC39 et al. And we still don&apos;t know what will happen to DOMException. See bug 23367.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>97425</commentid>
    <comment_count>2</comment_count>
    <who name="Philip Jägenstedt">philipj</who>
    <bug_when>2013-12-10 22:43:28 +0000</bug_when>
    <thetext>What should happen to the gazillion places that already throw some kind of DOMException? I doubt that changing the exception type for some heavily used API will be Web compatible...</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>97429</commentid>
    <comment_count>3</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2013-12-10 23:10:01 +0000</bug_when>
    <thetext>We&apos;ll have to sort that out. I was mostly trying to avoid it for new APIs.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>97434</commentid>
    <comment_count>4</comment_count>
    <who name="Philip Jägenstedt">philipj</who>
    <bug_when>2013-12-10 23:43:21 +0000</bug_when>
    <thetext>Bug 23367 has very little context, can you explain what&apos;s going on here? It&apos;s not immediately obvious what the problem with DOMException is.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>97446</commentid>
    <comment_count>5</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2013-12-11 11:32:43 +0000</bug_when>
    <thetext>People from TC39 have argued we should have less exceptions and use JavaScript exceptions when applicable (as we already do at the binding level). And they have argued that e.name should equal the name of e&apos;s interface (not the case for DOMException at the moment).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>106644</commentid>
    <comment_count>6</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2014-05-22 13:38:37 +0000</bug_when>
    <thetext>Okay, I admit defeat. New APIs can do this, but if someone wants to change old APIs they have to convince implementers themselves.

https://github.com/whatwg/dom/commit/39c292711896215afea75e1f4bbce601321d6011</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>107153</commentid>
    <comment_count>7</comment_count>
    <who name="Arkadiusz Michalski (Spirit)">crimsteam</who>
    <bug_when>2014-06-02 19:09:36 +0000</bug_when>
    <thetext>If you changed matches() then what about querySelector() and querySelectorAll()? This methods are older than matches(), but still in &quot;scope-match a selectors string &quot; algo we have:

2. If s is failure, throw a JavaScript TypeError. 

Firefox, Chrome and IE return SyntaxError (query() and queryAll() still not supported so skipping them). This behaviour is correct per Selectors API Level 1/Selectors API Level 2:

http://www.w3.org/TR/selectors-api/#parse-a-selector
http://dev.w3.org/2006/webapi/selectors-api2/#parse-a-selector

so really any implementators wants/plans change this?

Similar for MutationObserver.observe(), but in this case we have something news, and at least Chrome throw TypeError, so maybe in future other browsers do the same.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>107177</commentid>
    <comment_count>8</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2014-06-03 06:00:09 +0000</bug_when>
    <thetext>Could you please file a separate bug?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>107191</commentid>
    <comment_count>9</comment_count>
    <who name="Arkadiusz Michalski (Spirit)">crimsteam</who>
    <bug_when>2014-06-03 10:26:39 +0000</bug_when>
    <thetext>(In reply to Anne from comment #8)
&gt; Could you please file a separate bug?

https://www.w3.org/Bugs/Public/show_bug.cgi?id=25958</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>