<?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>23529</bug_id>
          
          <creation_ts>2013-10-15 22:23:46 +0000</creation_ts>
          <short_desc>Behavior of CSS.escape(undefined)</short_desc>
          <delta_ts>2013-10-16 10:56:07 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>CSS</product>
          <component>CSSOM</component>
          <version>unspecified</version>
          <rep_platform>PC</rep_platform>
          <op_sys>All</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="Simon Pieters">zcorpan</reporter>
          <assigned_to name="Simon Pieters">zcorpan</assigned_to>
          
          
          <qa_contact>public-css-bugzilla</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>94798</commentid>
    <comment_count>0</comment_count>
    <who name="Simon Pieters">zcorpan</who>
    <bug_when>2013-10-15 22:23:46 +0000</bug_when>
    <thetext>http://dev.w3.org/csswg/cssom/#the-css.escape()-method

[[
escape(DOMString ident)
]]

Consider returning &quot;undefined&quot; instead of throwing.

http://krijnhoetmer.nl/irc-logs/whatwg/20131015#l-485
http://krijnhoetmer.nl/irc-logs/whatwg/20131016</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>94819</commentid>
    <comment_count>1</comment_count>
    <who name="Simon Pieters">zcorpan</who>
    <bug_when>2013-10-16 10:56:07 +0000</bug_when>
    <thetext>I had misunderstood WebIDL. The current behavior is as follows:

CSS.escape() throws TypeError.
CSS.escape(undefined) returns &quot;undefined&quot;

This is consistent with other DOM methods like e.g. document.getElementById. However, it&apos;s inconsistent with JS functions like encodeURIComponent which makes omitted argument also return &quot;undefined&quot;.

The pro-throwing argument is mainly that it&apos;s easier to debug an error like

   CSS.escape(someobject.propertyThatDoesntExist)

However, no other method that takes a DOMString seems to throw for that case.

I think this settles that CSS.escape(undefined) should return &quot;undefined&quot;.

What to do for CSS.escape() without argument is less clear (be consistent with encodeURIComponent or with document.getElementById). But also seems less important. Let&apos;s stick with WebIDL&apos;s default for that case.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>