<?xml-stylesheet href="../../../style/xhtml-full.css" type="text/css"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
 <head>
  <title>Dynamic handling of attribute selectors</title>
  <meta name="author" content="Ian Hickson"/>
  <link rel="stylesheet" type="text/css" href="../../../style/xhtml-full.css"/> <!-- yes this means compliant UAs get to import this twice -->
  <style type="text/css"><![CDATA[
   @namespace url();
   @namespace ns url();
   test { background: red; display: block; padding: 1em; }
   stub ~ [ns|attribute^=start]:not([ns|attribute~=mid])[ns|attribute*=dle][ns|attribute$=end] ~ test [ { background: lime; }
]]></style>
  <link rel="first" href="css3-modsel-d1.xml" title="NEGATED Dynamic handling of :empty"/>
  <link rel="prev" href="css3-modsel-d2.xml" title="Dynamic handling of combinators"/>
  <link rel="next" href="css3-modsel-d4.xml" title="Dynamic updating of :first-child and :last-child"/>
  <link rel="last" href="css3-modsel-d4.xml" title="Dynamic updating of :first-child and :last-child"/>
  <link rel="up" href="./index.html"/>
  <link rel="top" href="../../../index.html"/>
 </head>
 <body>
  <table class="testDescription">
   <tr>
    <th class="b">CSS 3 Module</th> <!-- XXX hard coded to say CSS 3 -->
    <th class="c" colspan="2">
     <a href="css3-modsel-d2.xml" title="Dynamic handling of combinators">&lt;==</a>
     Test #
     <a href="css3-modsel-d4.xml" title="Dynamic updating of :first-child and :last-child">==&gt;</a>
    </th>
   </tr>
   <tr>
    <td class="b">W3C Selectors</td>
    <td class="c" colspan="2">4 of 5 of the dynamic tests category</td>
   </tr>
   <tr>
    <th class="b">Testing</th>
    <th class="a">Date</th>
    <th class="a">Revision</th>
   </tr>
   <tr>
    <td class="b">Dynamic handling of attribute selectors (ID #d3)</td>
    <td class="a">20-november-2001</td>
    <td class="a">1.0</td>
   </tr>
  </table>
  <p class="WARNING">NOTE: The UA must support ECMA-262 and DOM Level 2 Core for this test.</p>
  <p class="WARNING">NOTE: The UA must support namespaces for this test.</p>
  <div class="testSource">
   <div class="testText">

 <div>

  <script>
   <![CDATA[

    function test() {
      document.getElementsByTagNameNS('', 'test')[1].setAttributeNS('', 'attribute', 'start middle end');
    }

    window.setTimeout(test, 100);
   ]]>
  </script>

  <p> The following block should be green. </p>

  <!-- root of selector -->
  <stub xmlns=""></stub>

  <!-- middle part of selector does not match this -->
  <test xmlns="" xmlns:none="" none:attribute="fake"></test>

  <!-- middle part of selector matches this once attribute is fixed -->
  <test xmlns="" xmlns:none="" none:attribute="start mid dle end"></test>

  <!-- subject of selector -->
  <test xmlns=""></test>

 </div>

</div>
   <pre class="rules">
   @namespace url();
   @namespace ns url();
   test { background: red; display: block; padding: 1em; }
   stub ~ [ns|attribute^=start]:not([ns|attribute~=mid])[ns|attribute*=dle][ns|attribute$=end] ~ test [ { background: lime; }
</pre>
   <pre class="rules">

 &lt;div&gt;

  &lt;script&gt;
   &lt;![CDATA[

    function test() {
      document.getElementsByTagNameNS(&#39;&#39;, &#39;test&#39;)[1].setAttributeNS(&#39;&#39;, &#39;attribute&#39;, &#39;start middle end&#39;);
    }

    window.setTimeout(test, 100);
   ]]&gt;
  &lt;/script&gt;

  &lt;p&gt; The following block should be green. &lt;/p&gt;

  &lt;!-- root of selector --&gt;
  &lt;stub xmlns=&quot;&quot;&gt;&lt;/stub&gt;

  &lt;!-- middle part of selector does not match this --&gt;
  &lt;test xmlns=&quot;&quot; xmlns:none=&quot;&quot; none:attribute=&quot;fake&quot;&gt;&lt;/test&gt;

  &lt;!-- middle part of selector matches this once attribute is fixed --&gt;
  &lt;test xmlns=&quot;&quot; xmlns:none=&quot;&quot; none:attribute=&quot;start mid dle end&quot;&gt;&lt;/test&gt;

  &lt;!-- subject of selector --&gt;
  &lt;test xmlns=&quot;&quot;&gt;&lt;/test&gt;

 &lt;/div&gt;

</pre>
  </div>
 </body>
</html>