18e32145b4e03a65dfedc686a281d7a7f78d57a72Steve Block
28e32145b4e03a65dfedc686a281d7a7f78d57a72Steve Block/*
38e32145b4e03a65dfedc686a281d7a7f78d57a72Steve BlockCopyright © 2001-2004 World Wide Web Consortium,
48e32145b4e03a65dfedc686a281d7a7f78d57a72Steve Block(Massachusetts Institute of Technology, European Research Consortium
58e32145b4e03a65dfedc686a281d7a7f78d57a72Steve Blockfor Informatics and Mathematics, Keio University). All
68e32145b4e03a65dfedc686a281d7a7f78d57a72Steve BlockRights Reserved. This work is distributed under the W3C® Software License [1] in the
78e32145b4e03a65dfedc686a281d7a7f78d57a72Steve Blockhope that it will be useful, but WITHOUT ANY WARRANTY; without even
88e32145b4e03a65dfedc686a281d7a7f78d57a72Steve Blockthe implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
98e32145b4e03a65dfedc686a281d7a7f78d57a72Steve Block
108e32145b4e03a65dfedc686a281d7a7f78d57a72Steve Block[1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
118e32145b4e03a65dfedc686a281d7a7f78d57a72Steve Block*/
128e32145b4e03a65dfedc686a281d7a7f78d57a72Steve Block
138e32145b4e03a65dfedc686a281d7a7f78d57a72Steve Block
148e32145b4e03a65dfedc686a281d7a7f78d57a72Steve Block
158e32145b4e03a65dfedc686a281d7a7f78d57a72Steve Block   /**
168e32145b4e03a65dfedc686a281d7a7f78d57a72Steve Block    *  Gets URI that identifies the test.
178e32145b4e03a65dfedc686a281d7a7f78d57a72Steve Block    *  @return uri identifier of test
188e32145b4e03a65dfedc686a281d7a7f78d57a72Steve Block    */
198e32145b4e03a65dfedc686a281d7a7f78d57a72Steve Blockfunction getTargetURI() {
208e32145b4e03a65dfedc686a281d7a7f78d57a72Steve Block      return "http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLElement52";
218e32145b4e03a65dfedc686a281d7a7f78d57a72Steve Block   }
228e32145b4e03a65dfedc686a281d7a7f78d57a72Steve Block
238e32145b4e03a65dfedc686a281d7a7f78d57a72Steve Blockvar docsLoaded = -1000000;
248e32145b4e03a65dfedc686a281d7a7f78d57a72Steve Blockvar builder = null;
258e32145b4e03a65dfedc686a281d7a7f78d57a72Steve Block
268e32145b4e03a65dfedc686a281d7a7f78d57a72Steve Block//
278e32145b4e03a65dfedc686a281d7a7f78d57a72Steve Block//   This function is called by the testing framework before
288e32145b4e03a65dfedc686a281d7a7f78d57a72Steve Block//      running the test suite.
298e32145b4e03a65dfedc686a281d7a7f78d57a72Steve Block//
308e32145b4e03a65dfedc686a281d7a7f78d57a72Steve Block//   If there are no configuration exceptions, asynchronous
318e32145b4e03a65dfedc686a281d7a7f78d57a72Steve Block//        document loading is started.  Otherwise, the status
328e32145b4e03a65dfedc686a281d7a7f78d57a72Steve Block//        is set to complete and the exception is immediately
338e32145b4e03a65dfedc686a281d7a7f78d57a72Steve Block//        raised when entering the body of the test.
348e32145b4e03a65dfedc686a281d7a7f78d57a72Steve Block//
358e32145b4e03a65dfedc686a281d7a7f78d57a72Steve Blockfunction setUpPage() {
368e32145b4e03a65dfedc686a281d7a7f78d57a72Steve Block   setUpPageStatus = 'running';
378e32145b4e03a65dfedc686a281d7a7f78d57a72Steve Block   try {
388e32145b4e03a65dfedc686a281d7a7f78d57a72Steve Block     //
398e32145b4e03a65dfedc686a281d7a7f78d57a72Steve Block     //   creates test document builder, may throw exception
408e32145b4e03a65dfedc686a281d7a7f78d57a72Steve Block     //
418e32145b4e03a65dfedc686a281d7a7f78d57a72Steve Block     builder = createConfiguredBuilder();
428e32145b4e03a65dfedc686a281d7a7f78d57a72Steve Block
438e32145b4e03a65dfedc686a281d7a7f78d57a72Steve Block      docsLoaded = 0;
448e32145b4e03a65dfedc686a281d7a7f78d57a72Steve Block
458e32145b4e03a65dfedc686a281d7a7f78d57a72Steve Block      var docRef = null;
468e32145b4e03a65dfedc686a281d7a7f78d57a72Steve Block      if (typeof(this.doc) != 'undefined') {
478e32145b4e03a65dfedc686a281d7a7f78d57a72Steve Block        docRef = this.doc;
488e32145b4e03a65dfedc686a281d7a7f78d57a72Steve Block      }
498e32145b4e03a65dfedc686a281d7a7f78d57a72Steve Block      docsLoaded += preload(docRef, "doc", "element");
508e32145b4e03a65dfedc686a281d7a7f78d57a72Steve Block
518e32145b4e03a65dfedc686a281d7a7f78d57a72Steve Block       if (docsLoaded == 1) {
528e32145b4e03a65dfedc686a281d7a7f78d57a72Steve Block          setUpPageStatus = 'complete';
538e32145b4e03a65dfedc686a281d7a7f78d57a72Steve Block       }
548e32145b4e03a65dfedc686a281d7a7f78d57a72Steve Block    } catch(ex) {
558e32145b4e03a65dfedc686a281d7a7f78d57a72Steve Block    	catchInitializationError(builder, ex);
568e32145b4e03a65dfedc686a281d7a7f78d57a72Steve Block        setUpPageStatus = 'complete';
578e32145b4e03a65dfedc686a281d7a7f78d57a72Steve Block    }
588e32145b4e03a65dfedc686a281d7a7f78d57a72Steve Block}
598e32145b4e03a65dfedc686a281d7a7f78d57a72Steve Block
608e32145b4e03a65dfedc686a281d7a7f78d57a72Steve Block
618e32145b4e03a65dfedc686a281d7a7f78d57a72Steve Block
628e32145b4e03a65dfedc686a281d7a7f78d57a72Steve Block//
638e32145b4e03a65dfedc686a281d7a7f78d57a72Steve Block//   This method is called on the completion of
648e32145b4e03a65dfedc686a281d7a7f78d57a72Steve Block//      each asychronous load started in setUpTests.
658e32145b4e03a65dfedc686a281d7a7f78d57a72Steve Block//
668e32145b4e03a65dfedc686a281d7a7f78d57a72Steve Block//   When every synchronous loaded document has completed,
678e32145b4e03a65dfedc686a281d7a7f78d57a72Steve Block//      the page status is changed which allows the
688e32145b4e03a65dfedc686a281d7a7f78d57a72Steve Block//      body of the test to be executed.
698e32145b4e03a65dfedc686a281d7a7f78d57a72Steve Blockfunction loadComplete() {
708e32145b4e03a65dfedc686a281d7a7f78d57a72Steve Block    if (++docsLoaded == 1) {
718e32145b4e03a65dfedc686a281d7a7f78d57a72Steve Block        setUpPageStatus = 'complete';
728e32145b4e03a65dfedc686a281d7a7f78d57a72Steve Block    }
738e32145b4e03a65dfedc686a281d7a7f78d57a72Steve Block}
748e32145b4e03a65dfedc686a281d7a7f78d57a72Steve Block
758e32145b4e03a65dfedc686a281d7a7f78d57a72Steve Block
768e32145b4e03a65dfedc686a281d7a7f78d57a72Steve Block/**
778e32145b4e03a65dfedc686a281d7a7f78d57a72Steve Block*
788e32145b4e03a65dfedc686a281d7a7f78d57a72Steve Block    The title attribute specifies the elements advisory title.
798e32145b4e03a65dfedc686a281d7a7f78d57a72Steve Block
808e32145b4e03a65dfedc686a281d7a7f78d57a72Steve Block    Retrieve the title attribute of the ABBR element and examine its value.
818e32145b4e03a65dfedc686a281d7a7f78d57a72Steve Block
828e32145b4e03a65dfedc686a281d7a7f78d57a72Steve Block* @author NIST
838e32145b4e03a65dfedc686a281d7a7f78d57a72Steve Block* @author Mary Brady
848e32145b4e03a65dfedc686a281d7a7f78d57a72Steve Block* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-78276800
858e32145b4e03a65dfedc686a281d7a7f78d57a72Steve Block*/
868e32145b4e03a65dfedc686a281d7a7f78d57a72Steve Blockfunction HTMLElement52() {
878e32145b4e03a65dfedc686a281d7a7f78d57a72Steve Block   var success;
888e32145b4e03a65dfedc686a281d7a7f78d57a72Steve Block    if(checkInitialization(builder, "HTMLElement52") != null) return;
898e32145b4e03a65dfedc686a281d7a7f78d57a72Steve Block    var nodeList;
908e32145b4e03a65dfedc686a281d7a7f78d57a72Steve Block      var testNode;
918e32145b4e03a65dfedc686a281d7a7f78d57a72Steve Block      var vtitle;
928e32145b4e03a65dfedc686a281d7a7f78d57a72Steve Block      var doc;
938e32145b4e03a65dfedc686a281d7a7f78d57a72Steve Block
948e32145b4e03a65dfedc686a281d7a7f78d57a72Steve Block      var docRef = null;
958e32145b4e03a65dfedc686a281d7a7f78d57a72Steve Block      if (typeof(this.doc) != 'undefined') {
968e32145b4e03a65dfedc686a281d7a7f78d57a72Steve Block        docRef = this.doc;
978e32145b4e03a65dfedc686a281d7a7f78d57a72Steve Block      }
988e32145b4e03a65dfedc686a281d7a7f78d57a72Steve Block      doc = load(docRef, "doc", "element");
998e32145b4e03a65dfedc686a281d7a7f78d57a72Steve Block      nodeList = doc.getElementsByTagName("abbr");
1008e32145b4e03a65dfedc686a281d7a7f78d57a72Steve Block      assertSize("Asize",1,nodeList);
1018e32145b4e03a65dfedc686a281d7a7f78d57a72Steve BlocktestNode = nodeList.item(0);
1028e32145b4e03a65dfedc686a281d7a7f78d57a72Steve Block      vtitle = testNode.title;
1038e32145b4e03a65dfedc686a281d7a7f78d57a72Steve Block
1048e32145b4e03a65dfedc686a281d7a7f78d57a72Steve Block      assertEquals("titleLink","ABBR Element",vtitle);
1058e32145b4e03a65dfedc686a281d7a7f78d57a72Steve Block
1068e32145b4e03a65dfedc686a281d7a7f78d57a72Steve Block}
1078e32145b4e03a65dfedc686a281d7a7f78d57a72Steve Block
1088e32145b4e03a65dfedc686a281d7a7f78d57a72Steve Block
1098e32145b4e03a65dfedc686a281d7a7f78d57a72Steve Block
1108e32145b4e03a65dfedc686a281d7a7f78d57a72Steve Block
1118e32145b4e03a65dfedc686a281d7a7f78d57a72Steve Blockfunction runTest() {
1128e32145b4e03a65dfedc686a281d7a7f78d57a72Steve Block   HTMLElement52();
1138e32145b4e03a65dfedc686a281d7a7f78d57a72Steve Block}
114