<?xml-stylesheet href="../../../style/xml-full.css" type="text/css"?>
<?xml-stylesheet href="css3-modsel-d3.css" type="text/css"?>
<test xmlns:xlink="http://www.w3.org/1999/xlink">
 <title>Dynamic handling of attribute selectors</title>
 <author>Ian Hickson</author>
 <metadata>
  <item> <name>CSS 3 Module</name> <data>W3C Selectors</data> </item>
  <item> <name>Next</name> <data xlink:type="simple" xlink:href="css3-modsel-d4.xml">Dynamic updating of :first-child and :last-child</data> </item>
  <item> <name>Previous</name> <data xlink:type="simple" xlink:href="css3-modsel-d2.xml">Dynamic handling of combinators</data> </item>
  <item> <name>Test #</name> <data>4 of 5 of the dynamic tests category</data> </item>
  <item> <name>Testing</name> <data>Dynamic handling of attribute selectors</data> </item>
  <item> <name>ID</name> <data>d3</data> </item>
  <item> <name>Date</name> <data>2005-02-24</data> </item>
  <item> <name>Revision</name> <data>1.3</data> </item>
 </metadata>
   <requirement>The UA must support ECMA-262 and DOM Level 2 Core for this test.</requirement>
   <requirement>The UA must support namespaces for this test.</requirement>
  <content>

 <div xmlns="http://www.w3.org/1999/xhtml">

  <script type="text/javascript">
   <![CDATA[

    function test() {
      document.getElementsByTagNameNS('', 't')[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 -->
  <t xmlns="" attribute="fake"></t>

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

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

 </div>

</content>
  <source>
   <css>
   [test] { background: red; display: block; padding: 1em; }
   stub ~ [|attribute^=start]:not([|attribute~=mid])[|attribute*=dle][|attribute$=end] ~ t { background: lime; }
</css>
   <xml>

 &lt;div xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;

  &lt;script type=&quot;text/javascript&quot;&gt;
   &lt;![CDATA[

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

    window.setTimeout(&quot;test()&quot;, 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;t xmlns=&quot;&quot; attribute=&quot;fake&quot;&gt;&lt;/t&gt;

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

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

 &lt;/div&gt;

</xml>
  </source>
</test>