Annotation of 2001/DOM-Test-Suite/ecmascript/DOMTestSuite.js, revision 1.6

1.1       dom-ts-4    1: /*
1.3       dom-ts-4    2: Copyright (c) 2003-2004 World Wide Web Consortium,
1.1       dom-ts-4    3: (Massachusetts Institute of Technology, Institut National de
                      4: Recherche en Informatique et en Automatique, Keio University). All
                      5: Rights Reserved. This program is distributed under the W3C's Software
                      6: Intellectual Property License. This program is distributed in the
                      7: hope that it will be useful, but WITHOUT ANY WARRANTY; without even
                      8: the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
                      9: PURPOSE.
                     10: See W3C License http://www.w3.org/Consortium/Legal/ for more details.
                     11: */
                     12: 
                     13: function updateImplementationAttribute(options, implAttribute) {
                     14:    var builderVal = builder.getImplementationAttribute(implAttribute);
                     15:    var disabled = false;
                     16:    for (var i = 0; i < builder.fixedAttributeNames.length; i++) {
                     17:       if (implAttribute == builder.fixedAttributeNames[i]) {
                     18:         disabled = true;
                     19:         break;
                     20:       }
                     21:    }
                     22:    updateTrueFalse(options, builderVal, disabled);
                     23: }
                     24: 
1.5       dom-ts-4   25: function updateTrueFalse(checkbox, builderVal, disabled) {
                     26:    checkbox.checked = builderVal;
                     27:    checkbox.disabled = disabled;
1.1       dom-ts-4   28: }
                     29: 
                     30: 
                     31: function onImplementationChange() {
                     32:     var implOptions = document.forms[0].implementation;
1.5       dom-ts-4   33:     var implName = null;
1.1       dom-ts-4   34:     for(var i = 0; i < implOptions.length; i++) {
                     35:         if (implOptions[i].checked) {
1.5       dom-ts-4   36:                implName = implOptions[i].value;
                     37:             builder = createBuilder(implName);
1.1       dom-ts-4   38:             break;
                     39:         }
                     40:     }
1.5       dom-ts-4   41:     document.forms[0].dom3lsFeatures.disabled = !(implName == "dom3ls");
1.1       dom-ts-4   42:     update();
                     43: }
                     44: 
                     45: 
                     46: 
                     47: function update() {
1.6     ! dom-ts-4   48:     var svgOption;
1.1       dom-ts-4   49:     updateTrueFalse(document.forms[0].asynchronous, builder.async, !builder.supportsAsyncChange);
                     50:     updateImplementationAttribute(document.forms[0].expandEntityReferences, "expandEntityReferences");
                     51:     updateImplementationAttribute(document.forms[0].ignoringElementContentWhitespace, "ignoringElementContentWhitespace");
                     52:     updateImplementationAttribute(document.forms[0].validating, "validating");
                     53:     updateImplementationAttribute(document.forms[0].coalescing, "coalescing");
                     54:     updateImplementationAttribute(document.forms[0].namespaceAware, "namespaceAware");
1.3       dom-ts-4   55:     updateImplementationAttribute(document.forms[0].ignoringComments, "ignoringComments");
1.1       dom-ts-4   56: 
                     57:     var contentTypes = document.forms[0].contentType;
                     58:     for(i = 0; i < contentTypes.length; i++) {
                     59:         if (contentTypes[i].value == builder.contentType) {
                     60:             contentTypes[i].checked = true;
                     61:         }
                     62:         var disabled = true;
                     63:         for(var j = 0; j < builder.supportedContentTypes.length; j++) {
                     64:             if (contentTypes[i].value == builder.supportedContentTypes[j]) {
                     65:                 disabled = false;
                     66:                 break;
                     67:             }
                     68:         }
                     69:         contentTypes[i].disabled = disabled;
                     70:     }
1.4       dom-ts-4   71: 
                     72:     if (typeof(ActiveXObject) == 'undefined')
                     73:     {
                     74:       document.getElementById('msxml3Impl').disabled = true;
                     75:       document.getElementById('msxml4Impl').disabled = true;
                     76:     }
                     77:     if (typeof(document.implementation) != 'undefined')
                     78:     {
                     79:       var impl = document.implementation;
1.5       dom-ts-4   80:       if (impl && typeof(impl.createLSParser) == 'undefined')
1.4       dom-ts-4   81:       {
                     82:         document.getElementById('dom3lsImpl').disabled = true;
                     83:       }
                     84:       if (impl && typeof(impl.createDocument) == 'undefined')
                     85:       {
                     86:         document.getElementById('mozillaXMLImpl').disabled = true;
                     87:       }
                     88:     }
1.5       dom-ts-4   89:     if (document.location.href.indexOf('/html/') != -1)
1.4       dom-ts-4   90:     {
1.5       dom-ts-4   91:       // HTML test suites do not have SVG files
1.6     ! dom-ts-4   92:       svgOption = document.getElementById('svgpluginImpl');
        !            93:       if (svgOption != null) {
        !            94:          svgOption.disabled = true;
        !            95:       }
        !            96:       svgOption = document.getElementById('contentTypeSVG');
        !            97:       if (svgOption != null) {
        !            98:          svgOption.disabled = true;
        !            99:       }
1.4       dom-ts-4  100:     }
                    101:     
1.1       dom-ts-4  102: }
                    103: 
                    104: 
                    105: function setImplementationAttribute(implAttr, implValue) {
                    106:     try {
                    107:         builder.setImplementationAttribute(implAttr, implValue);
                    108:     } catch(msg) {
                    109:         alert(msg);
                    110:         update();
                    111:     }
                    112: }
                    113: 
                    114: function setContentType(contentType) {
                    115:     for (var i = 0; i < builder.supportedContentTypes.length; i++) {
                    116:         if (builder.supportedContentTypes[i] == contentType) {
1.3       dom-ts-4  117:             builder.setContentType(contentType);
                    118:             update();
1.1       dom-ts-4  119:             return;
                    120:         }
                    121:     }
                    122:     alert(contentType + " not supported by selected implementation");
                    123:     update();
                    124: }
                    125: 
                    126: 
1.2       dom-ts-4  127: function fixTestPagePath() {
                    128:     var options = document.forms[0].testpage.options;
                    129:     for (var i = 0; i < options.length; i++) {
                    130:         if (options[i].selected && options[i].value.indexOf(':') == -1) {
                    131:             var pageURL = location.href;
                    132:             if (pageURL.indexOf('?') != -1) {
                    133:                 pageURL = pageURL.substring(0, pageURL.indexOf('?'));
                    134:             }
                    135:             var baseURL = pageURL.substring(0, pageURL.lastIndexOf('/') + 1);
                    136:             options[i].value = baseURL + options[i].value;
                    137:         }
1.1       dom-ts-4  138:     }
1.2       dom-ts-4  139:     return true;
1.1       dom-ts-4  140: }
1.2       dom-ts-4  141: 
1.5       dom-ts-4  142: function updateTestSubmission() {
                    143:    var hostname = "localhost";
                    144:    if (document.forms[0].submitCheckbox.checked) {
                    145:          document.forms[0].resultid.disabled = false;
                    146:          document.forms[0].submitresults.disabled = false;
                    147:          if (document.location.protocol == "http") {
                    148:                hostname = document.location.hostname;
                    149:          }
                    150:          document.forms[0].submitresults.value = hostname + ":8080/jsunit/acceptor";
                    151:    } else {
                    152:          document.forms[0].resultid.disabled = true;
                    153:          document.forms[0].submitresults.disabled = true;
                    154:          document.forms[0].submitresults.value = "";
                    155:    }
                    156: }
                    157: 
1.1       dom-ts-4  158: 

Webmaster