pax_global_header00006660000000000000000000000064141522370440014514gustar00rootroot0000000000000052 comment=a604d67995fe5b2b1ce73090d347c23eeed011eb jsdom-19.0.0/000077500000000000000000000000001415223704400127175ustar00rootroot00000000000000jsdom-19.0.0/.editorconfig000066400000000000000000000002231415223704400153710ustar00rootroot00000000000000root = true [*] end_of_line = lf insert_final_newline = true trim_trailing_whitespace = true charset = utf-8 indent_style = space indent_size = 2 jsdom-19.0.0/.eslintignore000066400000000000000000000013601415223704400154220ustar00rootroot00000000000000node_modules benchmark/browser-bundle.js benchmark/browser-runner.html test/worker-bundle.js lib/jsdom/browser/default-stylesheet.js lib/jsdom/level3/xpath.js lib/jsdom/living/generated/** test/*.js !test/chai-helpers.js !test/karma* !test/util.js test/api/fixtures test/jquery-fixtures test/to-port-to-wpts/files test/to-port-to-wpts/frame.js test/to-port-to-wpts/level1 test/to-port-to-wpts/level2 test/to-port-to-wpts/level3 test/to-port-to-wpts/script.js test/web-platform-tests/tests test/web-platform-tests/to-upstream/dom/nodes/Document-createComment-createTextNode.js test/web-platform-tests/to-upstream/svg/element-svg.html test/web-platform-tests/to-upstream/svg/svgstringlist.html test/web-platform-tests/to-upstream/**/*dont-upstream* jsdom-19.0.0/.eslintrc.json000066400000000000000000000036341415223704400155210ustar00rootroot00000000000000{ "root": true, "extends": "@domenic", "env": { "node": true }, "plugins": [ "jsdom-internal" ], "rules": { // Overrides for jsdom "array-element-newline": "off", "no-implied-eval": "off", "no-invalid-this": "off", "require-unicode-regexp": "off", "prefer-template": "off", "new-cap": ["error", { "capIsNewExceptions": ["ByteString", "USVString", "DOMString"] }], // Custom rules "jsdom-internal/hook-super-invocation": ["error", { "ancestor": "NodeImpl", "hook": "_attach" }, { "ancestor": "NodeImpl", "hook": "_detach" }, { "ancestor": "NodeImpl", "hook": "_descendantAdded" }, { "ancestor": "NodeImpl", "hook": "_descendantRemoved" }, { "ancestor": "NodeImpl", "hook": "_childTextContentChangeSteps" }, { "ancestor": "ElementImpl", "hook": "_attrModified" } ] }, // Rules limited to specific locations "overrides": [ { "files": ["lib/**"], "rules": { "no-restricted-properties": ["error", { "property": "getAttribute", "message": "Use 'getAttributeNS' with null as the namespace to access attributes within jsdom" }, { "property": "setAttribute", "message": "Use 'setAttributeNS' with null as the namespace to access attributes within jsdom" }, { "property": "hasAttribute", "message": "Use 'hasAttributeNS' with null as the namespace to access attributes within jsdom" }, { "property": "removeAttribute", "message": "Use 'removeAttributeNS' with null as the namespace to access attributes within jsdom" }, { "property": "toggleAttribute", "message": "Use 'setAttributeNS' and 'removeAttributeNS' with null as the namespace to access attributes within jsdom" } ] } }, { "files": ["test/api/**"], "rules": { "no-loop-func": "off" // interacts poorly with Mocha's before() and tests generated using loops } } ] } jsdom-19.0.0/.gitattributes000066400000000000000000000000611415223704400156070ustar00rootroot00000000000000# tests require lf line endings *.js text eol=lf jsdom-19.0.0/.github/000077500000000000000000000000001415223704400142575ustar00rootroot00000000000000jsdom-19.0.0/.github/ISSUE_TEMPLATE.md000066400000000000000000000015651415223704400167730ustar00rootroot00000000000000### Basic info: - **Node.js version:** - **jsdom version:** ### Minimal reproduction case ```js const { JSDOM } = require("jsdom"); const options = { ... your options here ... }; const dom = new JSDOM(` ... your HTML here ... `, options); ... your code that reproduces the problem here, probably using dom.window ... ``` ### How does similar code behave in browsers? (Link to a jsbin or similar strongly suggested.) jsdom-19.0.0/.github/workflows/000077500000000000000000000000001415223704400163145ustar00rootroot00000000000000jsdom-19.0.0/.github/workflows/jsdom-ci.yml000066400000000000000000000054341415223704400205520ustar00rootroot00000000000000# This workflow will do a clean install of node dependencies, build the source code and # run tests across different versions of node # For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions name: JSDOM-CI on: push: branches: - master pull_request: branches: - master jobs: lint: runs-on: ubuntu-20.04 steps: - uses: actions/checkout@v2 with: submodules: 'recursive' - name: Run linter uses: actions/setup-node@v2 with: node-version: '16' - name: Install dependencies run: yarn --frozen-lockfile - name: Run syntax rules check with ESLint run: yarn lint build-with-canvas: env: TEST_SUITE: 'node-canvas' runs-on: ubuntu-20.04 steps: - uses: actions/checkout@v2 with: submodules: 'recursive' - name: Run Canvas tests with Node 16 uses: actions/setup-node@v2 with: node-version: '16' - name: Install required image manipulation packages with APT run: sudo apt-get install build-essential libcairo2-dev libpango1.0-dev libjpeg-dev libgif-dev librsvg2-dev - name: Setup HOSTS file for Web Platform Test server run: ./test/web-platform-tests/tests/wpt make-hosts-file | sudo tee -a /etc/hosts - name: Install dependencies run: yarn --frozen-lockfile - name: Run tests run: yarn add canvas && yarn test --retries 1 build-with-browser: env: TEST_SUITE: 'browser' runs-on: ubuntu-20.04 steps: - uses: actions/checkout@v2 with: submodules: 'recursive' - name: Run web browser tests uses: actions/setup-node@v2 with: node-version: '16' - name: Setup HOSTS file for Web Platform Test server run: ./test/web-platform-tests/tests/wpt make-hosts-file | sudo tee -a /etc/hosts - name: Install dependencies run: yarn --frozen-lockfile - name: Run tests run: yarn test-browser build: runs-on: ubuntu-20.04 strategy: fail-fast: false matrix: node-version: - 12 - 14 - 16 architecture: - x64 steps: - uses: actions/checkout@v2 with: submodules: 'recursive' - name: Run tests with Node ${{ matrix.node-version }} uses: actions/setup-node@v2 with: node-version: ${{ matrix.node-version }} architecture: ${{ matrix.architecture }} - name: Setup HOSTS file for Web Platform Test server run: ./test/web-platform-tests/tests/wpt make-hosts-file | sudo tee -a /etc/hosts - name: Install dependencies run: yarn --frozen-lockfile - name: Run tests run: yarn test --retries 1 jsdom-19.0.0/.gitignore000066400000000000000000000004051415223704400147060ustar00rootroot00000000000000.DS_Store .svn .*.swp .eslintcache gmon.out v8.log node_modules package-lock.json test/worker-bundle.js test/web-platform-tests/tuwpt-manifest.json npm-debug.log* benchmark/browser-bundle.js lib/jsdom/living/generated/**/*.js lib/jsdom/browser/js-globals.json jsdom-19.0.0/.gitmodules000066400000000000000000000002071415223704400150730ustar00rootroot00000000000000[submodule "test/web-platform-tests/tests"] path = test/web-platform-tests/tests url = https://github.com/web-platform-tests/wpt.git jsdom-19.0.0/.mailmap000066400000000000000000000025061415223704400143430ustar00rootroot00000000000000Elijah Insua Brandon Paton Domenic Denicola Felix Gnass Felix Gnass Joris van der Wel Jos Shepherd Karuna Sagar Mariusz Nowak Nicolas LaCasse Nicolas LaCasse Robin ulteriorlife Ivan Nikulin Jeff Carpenter Sebastian Mayr Sebastian Mayr Sebastian Mayr Sebastian Mayr Pierre-Marie Dartus Martin Naumann Christoph Pojer Michał Gołębiowski-Owczarek Jesus David Garcia Gomez Magne Andersson jsdom-19.0.0/.npmignore000066400000000000000000000000311415223704400147100ustar00rootroot00000000000000/* !lib/ lib/**/*.webidl jsdom-19.0.0/AUTHORS.txt000066400000000000000000000274761415223704400146250ustar00rootroot00000000000000Adam Faulkner Adrian Lang Adrian Makowski airportyh alec Aleksei Tsikov Alex Coles Alex Pearson Alex Rattray Alex Soncodi Alexander Flatter Alexis CHAPPRON Alistair Brown Alistair MacDonald Alvaro Dias Ammar Khaku Anant Patni Andrea Bogazzi Andreas Fleig Andreas Lind Andreas Lind Petersen andrew morton Andrew Patton Andrew Plummer Andrew Smith Andy VanWagoner Anton Popov Anton Yefremov antonj Aria Stewart Arrix Aryan Arora Avery Fay Avi Deitcher Avi Vahl Behind The Math Brandon Bethke Brandon Paton Brendan Abbott Brian Donovan Brian Maissy Brian McDaniel Brian Peacock Carlos Serrano Chad Walker Chris Buckley Chris Carpita Chris Richard Christian Bewernitz Christof Marti Christoph Pojer Christophe Coevoet cjroebuck Connor Meredith <4907463+connormeredith@users.noreply.github.com> Cyril Auburtin daishi Damian Janowski Damien Rajon <145502+pyrho@users.noreply.github.com> Dan Lidral-Porter Daniel Boelzle [:dbo] Daniel Cassidy Daniel Cousens Daniël van de Burgt d-ash Dav Glass Dave Clark Dave Methvin Davide P. Cervone Derek Lindahl Domenic Denicola Dominic Gannaway dxgriffiths Dylan Marriott Edward O'Connor Edward Pfremmer Edwin Shin eiko eleith Elijah Insua E̵̘̳̘̝ṃ̟͈͙̗̹͘i͖͇ḷ͚͔̱̰̠y͜ ̩̲͕R̮̜͓̫o͉̣̦̘̖̖ͅs̫̣͜e̼͖̹̩͉͉͠ Enver Balalic Erik Vold Eugene Ware Evan Haas Evan Jacobs Evan Jones ExE Boss <3889017+ExE-Boss@users.noreply.github.com> fdesforges Federico Galassi fegs Felix Böhm Felix Gnass Flaviu Tamas Forbes Lindesay fr0z3nk0 Francis Saul Francisco Requena Frederic Hemberger FrozenCow Fumiaki MATSUSHIMA Futtetennista Gary Court Gianluca Guarini Godmar Back Gord Tanner Grant Gryczan gregory80 Haz Henrik Giesel Henry Zhu hij1nx i8-pi Ian Young Ikko Ashimine indexzero isaacs isonmad Ivan Nikulin Jack James Broad James Kyle James McMath James Treworgy Jameson Little Jamie Liu Jared Deckard Jason Davies Jason Orendorff Jason Palmer Jason Priestley jden Jean-Francois Remy Jeff Carpenter Jeremy Danyow Jérémy Lal Jerry Sievert Jesus David Garcia Gomez Jimmy Mabey Joe Lencioni Johan Sköld John Hurliman John Nguyen John Roberts Jon Sakas Jonathan Commins Jonathan Ong Joris van der Wel Jörn Hees Jos Shepherd Joscha Feth José Valim Joseph Frazier <1212jtraceur@gmail.com> Josh Marshall Joshua Peek JuFeng Zhang Julien Guimont Jürg Lehni justinmchase Kai kangax Karel Bruneel <1569717+kbruneel@users.noreply.github.com> Karl Horky Karl Norling Karuna Sagar Kasper Isager kblomquist Ken "Elf" Mathieu Sternberg Kenneth Powers Kevin Gibbons Kevin Raynel King Koopa Konto Mondo kontomondo Koushik Challa Krystan Honour Kuriyama hibiya Kyle Kyle McFarland Kyle Rose Lauri Heiskanen liucougar Lon Ingram Louis-Dominique Dubeau lovebear Lucian Buzzo Ludovico Fischer Luis Silva Lukas Bünger lul-odoo Magne Andersson makana Manuel Lopez Marak Squires Marc-Andre Lafortune Mariusz Nowak Martin Naumann Matt Broadstone Matthew Crinklaw-Vogt Matthew Glazar Matthew Goldberg Matthew King Matthew Pflueger Matthew Phillips Mattias Buelens <649348+MattiasBuelens@users.noreply.github.com> Max Walker Maxim Vorobjov Michael Best Michael Fleet Michael Hayes Michael Mior Michael Orchard Michał Gołębiowski-Owczarek Michał Wadas Mike Bostock Mike Schreifels Mitar Nao Iizuka Nick McCurdy Nick Oliver Nick Stenning Nicklas Gummesson Nicolas HENRY Nicolas LaCasse Nik Nyby ninevra Ojek Olivier El Mekki Ondřej Žára Onur Yıldırım Pascal Bayer Paul O’Shannessy peller Pepijn Verlaan Pete Bevin Péter Peter Lyons Phil Dokas Philipp Fritsche Philippe Ozil <5071767+pozil@users.noreply.github.com> Pierre-Marie Dartus Rafał Chłodnicki Rainer Eli Ralph Holzmann Ra'Shaun Stovall Ra'Shaun Stovall Remy Loubradou reviewher <24845478+reviewher@users.noreply.github.com> Rich Harris Ricky Chien Ricordisamoa Rob Dodson Robin Robin Berjon Rodrigo Flores Rolf Timmermans Romain Trotard Ronald Rey Rondinelly Ryan Gasparini Ryan Grove Ryan Seddon Ryan T Ryan Wolf S Sesha Sendhil Salvatore Porchia Sam Ruby Sammy Jelin Samori Gorse saucy Scott Albertine Scott Ashton Sean Jacke Sebastian Mayr Sebastian McKenzie Sebastian Silbermann Sergei Ianovich Shimon Doodkin Silvio Tomatis Simen Bekkhus Simon Müller Simon Weimann sonnym Soufiane Ghzal sporchia Stefan Buck Stephen Bannasch sterpe steve Steve Conover Sven Müller Swizec Teller Thiago Hirata Thomas Chung Tiago Rodrigues Timothy Gu timu Tobie Tom Hudson Tom Jenkinson Tom Taylor ulteriorlife Vadim Baryshev Vegard B. Bugge Vincent Desjardins Vincent Siao VinothKumar Raman vsemozhetbyt Vytautas Jakutis waslogic Wei Dai William Cunningham Xavi Yonathan ytetsuro Yun Cui Yunlei Liu Zach Bjornson Zach Smith jsdom-19.0.0/Changelog.md000066400000000000000000004367201415223704400151440ustar00rootroot00000000000000# jsdom Changelog ## 19.0.0 * Changed `jsdom.nodeLocation()` to return `undefined` when used on nodes that originate via fragment parsing (e.g., via `innerHTML`). Previously it would return based on the node location of the fragment string, which made node locations unreliable with respect to the original document source. This restores the behavior that was present in v14.0.0, and was accidentally broken in v14.1.0. (bakkot) * Fixed calling `window.close()` inside the `Window`'s `load` event to no longer crash. (MattiasBuelens) ## 18.1.1 * Fixed `connectedCallback` to fire in situations involving document fragments, which was broken in v18.0.1. (GrantGryczan) ## 18.1.0 * Fixed `headers.append()` and `headers.set()` to normalize values. (MattiasBuelens) * Fixed `pageshow` events to have `bubbles: true` and `cancelable: true`. (MattiasBuelens) * Implemented the `reason` property on `AbortSignal`s, along with the corresponding `reason` argument to `abortSignal.abort()` and `AbortSignal.abort()`. (MattiasBuelens) ## 18.0.1 * Fixed live `Range`s to update correctly after calling `node.normalize()`. (hgiesel) * Fixed live `Range`s to update correctly after removing child nodes. (hgiesel) * Fixed setting `inputEl.valueAsDate = null` to no longer throw an exception, but instead set the value to the empty string. (simon-weimann) * Improved performance of node insertion and `node.contains()`. (GrantGryczan) ## 18.0.0 Potentially-breaking bug fixes: * Fixed SSL certificate checking for WebSocket connections. Previously, invalid SSL certificates were always accepted; now, they properly respect the `ResourceLoader`'s `strictSSL` option (which defaults to `true`). * Changed the global in which almost all `Promise` and `TypeError` instances are created to be the jsdom global, not the Node.js global. This could affect any code that uses `instanceof`. Other changes: * Fixed moving an element between HTML and XML documents to reset the `tagName` cache, allowing it to return a lowercase value once it's in the XML document. (LucasLefevre) * Fixed form submission to not happen when the form is invalid. (pozil) ## 17.0.0 Breaking change: Node v12 is now the minimum supported version. ## 16.7.0 * Added `AbortSignal.abort()`. (ninevra) * Added dummy `x` and `y` properties to the return value of `getBoundingClientRect()`. (eiko) * Implemented wrapping for `textareaEl.value` if the `wrap=""` attribute is specified. (ninevra) * Changed newline normalization in `"; support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue; // #11217 - WebKit loses check when the name is after the checked attribute fragment.appendChild( div ); div.innerHTML = ""; // Support: Safari 5.1, iOS 5.1, Android 4.x, Android 2.3 // old WebKit doesn't clone checked state correctly in fragments support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked; // Support: IE<9 // Opera does not clone events (and typeof div.attachEvent === undefined). // IE9-10 clones events bound via attachEvent, but they don't trigger with .click() support.noCloneEvent = true; if ( div.attachEvent ) { div.attachEvent( "onclick", function() { support.noCloneEvent = false; }); div.cloneNode( true ).click(); } // Execute the test only if not already executed in another module. if (support.deleteExpando == null) { // Support: IE<9 support.deleteExpando = true; try { delete div.test; } catch( e ) { support.deleteExpando = false; } } // Null elements to avoid leaks in IE. fragment = div = input = null; })(); (function() { var i, eventName, div = document.createElement( "div" ); // Support: IE<9 (lack submit/change bubble), Firefox 23+ (lack focusin event) for ( i in { submit: true, change: true, focusin: true }) { eventName = "on" + i; if ( !(support[ i + "Bubbles" ] = eventName in window) ) { // Beware of CSP restrictions (https://developer.mozilla.org/en/Security/CSP) div.setAttribute( eventName, "t" ); support[ i + "Bubbles" ] = div.attributes[ eventName ].expando === false; } } // Null elements to avoid leaks in IE. div = null; })(); var rformElems = /^(?:input|select|textarea)$/i, rkeyEvent = /^key/, rmouseEvent = /^(?:mouse|contextmenu)|click/, rfocusMorph = /^(?:focusinfocus|focusoutblur)$/, rtypenamespace = /^([^.]*)(?:\.(.+)|)$/; function returnTrue() { return true; } function returnFalse() { return false; } function safeActiveElement() { try { return document.activeElement; } catch ( err ) { } } /* * Helper functions for managing events -- not part of the public interface. * Props to Dean Edwards' addEvent library for many of the ideas. */ jQuery.event = { global: {}, add: function( elem, types, handler, data, selector ) { var tmp, events, t, handleObjIn, special, eventHandle, handleObj, handlers, type, namespaces, origType, elemData = jQuery._data( elem ); // Don't attach events to noData or text/comment nodes (but allow plain objects) if ( !elemData ) { return; } // Caller can pass in an object of custom data in lieu of the handler if ( handler.handler ) { handleObjIn = handler; handler = handleObjIn.handler; selector = handleObjIn.selector; } // Make sure that the handler has a unique ID, used to find/remove it later if ( !handler.guid ) { handler.guid = jQuery.guid++; } // Init the element's event structure and main handler, if this is the first if ( !(events = elemData.events) ) { events = elemData.events = {}; } if ( !(eventHandle = elemData.handle) ) { eventHandle = elemData.handle = function( e ) { // Discard the second event of a jQuery.event.trigger() and // when an event is called after a page has unloaded return typeof jQuery !== strundefined && (!e || jQuery.event.triggered !== e.type) ? jQuery.event.dispatch.apply( eventHandle.elem, arguments ) : undefined; }; // Add elem as a property of the handle fn to prevent a memory leak with IE non-native events eventHandle.elem = elem; } // Handle multiple events separated by a space types = ( types || "" ).match( rnotwhite ) || [ "" ]; t = types.length; while ( t-- ) { tmp = rtypenamespace.exec( types[t] ) || []; type = origType = tmp[1]; namespaces = ( tmp[2] || "" ).split( "." ).sort(); // There *must* be a type, no attaching namespace-only handlers if ( !type ) { continue; } // If event changes its type, use the special event handlers for the changed type special = jQuery.event.special[ type ] || {}; // If selector defined, determine special event api type, otherwise given type type = ( selector ? special.delegateType : special.bindType ) || type; // Update special based on newly reset type special = jQuery.event.special[ type ] || {}; // handleObj is passed to all event handlers handleObj = jQuery.extend({ type: type, origType: origType, data: data, handler: handler, guid: handler.guid, selector: selector, needsContext: selector && jQuery.expr.match.needsContext.test( selector ), namespace: namespaces.join(".") }, handleObjIn ); // Init the event handler queue if we're the first if ( !(handlers = events[ type ]) ) { handlers = events[ type ] = []; handlers.delegateCount = 0; // Only use addEventListener/attachEvent if the special events handler returns false if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) { // Bind the global event handler to the element if ( elem.addEventListener ) { elem.addEventListener( type, eventHandle, false ); } else if ( elem.attachEvent ) { elem.attachEvent( "on" + type, eventHandle ); } } } if ( special.add ) { special.add.call( elem, handleObj ); if ( !handleObj.handler.guid ) { handleObj.handler.guid = handler.guid; } } // Add to the element's handler list, delegates in front if ( selector ) { handlers.splice( handlers.delegateCount++, 0, handleObj ); } else { handlers.push( handleObj ); } // Keep track of which events have ever been used, for event optimization jQuery.event.global[ type ] = true; } // Nullify elem to prevent memory leaks in IE elem = null; }, // Detach an event or set of events from an element remove: function( elem, types, handler, selector, mappedTypes ) { var j, handleObj, tmp, origCount, t, events, special, handlers, type, namespaces, origType, elemData = jQuery.hasData( elem ) && jQuery._data( elem ); if ( !elemData || !(events = elemData.events) ) { return; } // Once for each type.namespace in types; type may be omitted types = ( types || "" ).match( rnotwhite ) || [ "" ]; t = types.length; while ( t-- ) { tmp = rtypenamespace.exec( types[t] ) || []; type = origType = tmp[1]; namespaces = ( tmp[2] || "" ).split( "." ).sort(); // Unbind all events (on this namespace, if provided) for the element if ( !type ) { for ( type in events ) { jQuery.event.remove( elem, type + types[ t ], handler, selector, true ); } continue; } special = jQuery.event.special[ type ] || {}; type = ( selector ? special.delegateType : special.bindType ) || type; handlers = events[ type ] || []; tmp = tmp[2] && new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" ); // Remove matching events origCount = j = handlers.length; while ( j-- ) { handleObj = handlers[ j ]; if ( ( mappedTypes || origType === handleObj.origType ) && ( !handler || handler.guid === handleObj.guid ) && ( !tmp || tmp.test( handleObj.namespace ) ) && ( !selector || selector === handleObj.selector || selector === "**" && handleObj.selector ) ) { handlers.splice( j, 1 ); if ( handleObj.selector ) { handlers.delegateCount--; } if ( special.remove ) { special.remove.call( elem, handleObj ); } } } // Remove generic event handler if we removed something and no more handlers exist // (avoids potential for endless recursion during removal of special event handlers) if ( origCount && !handlers.length ) { if ( !special.teardown || special.teardown.call( elem, namespaces, elemData.handle ) === false ) { jQuery.removeEvent( elem, type, elemData.handle ); } delete events[ type ]; } } // Remove the expando if it's no longer used if ( jQuery.isEmptyObject( events ) ) { delete elemData.handle; // removeData also checks for emptiness and clears the expando if empty // so use it instead of delete jQuery._removeData( elem, "events" ); } }, trigger: function( event, data, elem, onlyHandlers ) { var handle, ontype, cur, bubbleType, special, tmp, i, eventPath = [ elem || document ], type = hasOwn.call( event, "type" ) ? event.type : event, namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split(".") : []; cur = tmp = elem = elem || document; // Don't do events on text and comment nodes if ( elem.nodeType === 3 || elem.nodeType === 8 ) { return; } // focus/blur morphs to focusin/out; ensure we're not firing them right now if ( rfocusMorph.test( type + jQuery.event.triggered ) ) { return; } if ( type.indexOf(".") >= 0 ) { // Namespaced trigger; create a regexp to match event type in handle() namespaces = type.split("."); type = namespaces.shift(); namespaces.sort(); } ontype = type.indexOf(":") < 0 && "on" + type; // Caller can pass in a jQuery.Event object, Object, or just an event type string event = event[ jQuery.expando ] ? event : new jQuery.Event( type, typeof event === "object" && event ); // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true) event.isTrigger = onlyHandlers ? 2 : 3; event.namespace = namespaces.join("."); event.namespace_re = event.namespace ? new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" ) : null; // Clean up the event in case it is being reused event.result = undefined; if ( !event.target ) { event.target = elem; } // Clone any incoming data and prepend the event, creating the handler arg list data = data == null ? [ event ] : jQuery.makeArray( data, [ event ] ); // Allow special events to draw outside the lines special = jQuery.event.special[ type ] || {}; if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) { return; } // Determine event propagation path in advance, per W3C events spec (#9951) // Bubble up to document, then to window; watch for a global ownerDocument var (#9724) if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) { bubbleType = special.delegateType || type; if ( !rfocusMorph.test( bubbleType + type ) ) { cur = cur.parentNode; } for ( ; cur; cur = cur.parentNode ) { eventPath.push( cur ); tmp = cur; } // Only add window if we got to document (e.g., not plain obj or detached DOM) if ( tmp === (elem.ownerDocument || document) ) { eventPath.push( tmp.defaultView || tmp.parentWindow || window ); } } // Fire handlers on the event path i = 0; while ( (cur = eventPath[i++]) && !event.isPropagationStopped() ) { event.type = i > 1 ? bubbleType : special.bindType || type; // jQuery handler handle = ( jQuery._data( cur, "events" ) || {} )[ event.type ] && jQuery._data( cur, "handle" ); if ( handle ) { handle.apply( cur, data ); } // Native handler handle = ontype && cur[ ontype ]; if ( handle && handle.apply && jQuery.acceptData( cur ) ) { event.result = handle.apply( cur, data ); if ( event.result === false ) { event.preventDefault(); } } } event.type = type; // If nobody prevented the default action, do it now if ( !onlyHandlers && !event.isDefaultPrevented() ) { if ( (!special._default || special._default.apply( eventPath.pop(), data ) === false) && jQuery.acceptData( elem ) ) { // Call a native DOM method on the target with the same name name as the event. // Can't use an .isFunction() check here because IE6/7 fails that test. // Don't do default actions on window, that's where global variables be (#6170) if ( ontype && elem[ type ] && !jQuery.isWindow( elem ) ) { // Don't re-trigger an onFOO event when we call its FOO() method tmp = elem[ ontype ]; if ( tmp ) { elem[ ontype ] = null; } // Prevent re-triggering of the same event, since we already bubbled it above jQuery.event.triggered = type; try { elem[ type ](); } catch ( e ) { // IE<9 dies on focus/blur to hidden element (#1486,#12518) // only reproducible on winXP IE8 native, not IE9 in IE8 mode } jQuery.event.triggered = undefined; if ( tmp ) { elem[ ontype ] = tmp; } } } } return event.result; }, dispatch: function( event ) { // Make a writable jQuery.Event from the native event object event = jQuery.event.fix( event ); var i, ret, handleObj, matched, j, handlerQueue = [], args = slice.call( arguments ), handlers = ( jQuery._data( this, "events" ) || {} )[ event.type ] || [], special = jQuery.event.special[ event.type ] || {}; // Use the fix-ed jQuery.Event rather than the (read-only) native event args[0] = event; event.delegateTarget = this; // Call the preDispatch hook for the mapped type, and let it bail if desired if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) { return; } // Determine handlers handlerQueue = jQuery.event.handlers.call( this, event, handlers ); // Run delegates first; they may want to stop propagation beneath us i = 0; while ( (matched = handlerQueue[ i++ ]) && !event.isPropagationStopped() ) { event.currentTarget = matched.elem; j = 0; while ( (handleObj = matched.handlers[ j++ ]) && !event.isImmediatePropagationStopped() ) { // Triggered event must either 1) have no namespace, or // 2) have namespace(s) a subset or equal to those in the bound event (both can have no namespace). if ( !event.namespace_re || event.namespace_re.test( handleObj.namespace ) ) { event.handleObj = handleObj; event.data = handleObj.data; ret = ( (jQuery.event.special[ handleObj.origType ] || {}).handle || handleObj.handler ) .apply( matched.elem, args ); if ( ret !== undefined ) { if ( (event.result = ret) === false ) { event.preventDefault(); event.stopPropagation(); } } } } } // Call the postDispatch hook for the mapped type if ( special.postDispatch ) { special.postDispatch.call( this, event ); } return event.result; }, handlers: function( event, handlers ) { var sel, handleObj, matches, i, handlerQueue = [], delegateCount = handlers.delegateCount, cur = event.target; // Find delegate handlers // Black-hole SVG instance trees (#13180) // Avoid non-left-click bubbling in Firefox (#3861) if ( delegateCount && cur.nodeType && (!event.button || event.type !== "click") ) { /* jshint eqeqeq: false */ for ( ; cur != this; cur = cur.parentNode || this ) { /* jshint eqeqeq: true */ // Don't check non-elements (#13208) // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764) if ( cur.nodeType === 1 && (cur.disabled !== true || event.type !== "click") ) { matches = []; for ( i = 0; i < delegateCount; i++ ) { handleObj = handlers[ i ]; // Don't conflict with Object.prototype properties (#13203) sel = handleObj.selector + " "; if ( matches[ sel ] === undefined ) { matches[ sel ] = handleObj.needsContext ? jQuery( sel, this ).index( cur ) >= 0 : jQuery.find( sel, this, null, [ cur ] ).length; } if ( matches[ sel ] ) { matches.push( handleObj ); } } if ( matches.length ) { handlerQueue.push({ elem: cur, handlers: matches }); } } } } // Add the remaining (directly-bound) handlers if ( delegateCount < handlers.length ) { handlerQueue.push({ elem: this, handlers: handlers.slice( delegateCount ) }); } return handlerQueue; }, fix: function( event ) { if ( event[ jQuery.expando ] ) { return event; } // Create a writable copy of the event object and normalize some properties var i, prop, copy, type = event.type, originalEvent = event, fixHook = this.fixHooks[ type ]; if ( !fixHook ) { this.fixHooks[ type ] = fixHook = rmouseEvent.test( type ) ? this.mouseHooks : rkeyEvent.test( type ) ? this.keyHooks : {}; } copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props; event = new jQuery.Event( originalEvent ); i = copy.length; while ( i-- ) { prop = copy[ i ]; event[ prop ] = originalEvent[ prop ]; } // Support: IE<9 // Fix target property (#1925) if ( !event.target ) { event.target = originalEvent.srcElement || document; } // Support: Chrome 23+, Safari? // Target should not be a text node (#504, #13143) if ( event.target.nodeType === 3 ) { event.target = event.target.parentNode; } // Support: IE<9 // For mouse/key events, metaKey==false if it's undefined (#3368, #11328) event.metaKey = !!event.metaKey; return fixHook.filter ? fixHook.filter( event, originalEvent ) : event; }, // Includes some event props shared by KeyEvent and MouseEvent props: "altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "), fixHooks: {}, keyHooks: { props: "char charCode key keyCode".split(" "), filter: function( event, original ) { // Add which for key events if ( event.which == null ) { event.which = original.charCode != null ? original.charCode : original.keyCode; } return event; } }, mouseHooks: { props: "button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "), filter: function( event, original ) { var body, eventDoc, doc, button = original.button, fromElement = original.fromElement; // Calculate pageX/Y if missing and clientX/Y available if ( event.pageX == null && original.clientX != null ) { eventDoc = event.target.ownerDocument || document; doc = eventDoc.documentElement; body = eventDoc.body; event.pageX = original.clientX + ( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) - ( doc && doc.clientLeft || body && body.clientLeft || 0 ); event.pageY = original.clientY + ( doc && doc.scrollTop || body && body.scrollTop || 0 ) - ( doc && doc.clientTop || body && body.clientTop || 0 ); } // Add relatedTarget, if necessary if ( !event.relatedTarget && fromElement ) { event.relatedTarget = fromElement === event.target ? original.toElement : fromElement; } // Add which for click: 1 === left; 2 === middle; 3 === right // Note: button is not normalized, so don't use it if ( !event.which && button !== undefined ) { event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) ); } return event; } }, special: { load: { // Prevent triggered image.load events from bubbling to window.load noBubble: true }, focus: { // Fire native event if possible so blur/focus sequence is correct trigger: function() { if ( this !== safeActiveElement() && this.focus ) { try { this.focus(); return false; } catch ( e ) { // Support: IE<9 // If we error on focus to hidden element (#1486, #12518), // let .trigger() run the handlers } } }, delegateType: "focusin" }, blur: { trigger: function() { if ( this === safeActiveElement() && this.blur ) { this.blur(); return false; } }, delegateType: "focusout" }, click: { // For checkbox, fire native event so checked state will be right trigger: function() { if ( jQuery.nodeName( this, "input" ) && this.type === "checkbox" && this.click ) { this.click(); return false; } }, // For cross-browser consistency, don't fire native .click() on links _default: function( event ) { return jQuery.nodeName( event.target, "a" ); } }, beforeunload: { postDispatch: function( event ) { // Even when returnValue equals to undefined Firefox will still show alert if ( event.result !== undefined ) { event.originalEvent.returnValue = event.result; } } } }, simulate: function( type, elem, event, bubble ) { // Piggyback on a donor event to simulate a different one. // Fake originalEvent to avoid donor's stopPropagation, but if the // simulated event prevents default then we do the same on the donor. var e = jQuery.extend( new jQuery.Event(), event, { type: type, isSimulated: true, originalEvent: {} } ); if ( bubble ) { jQuery.event.trigger( e, null, elem ); } else { jQuery.event.dispatch.call( elem, e ); } if ( e.isDefaultPrevented() ) { event.preventDefault(); } } }; jQuery.removeEvent = document.removeEventListener ? function( elem, type, handle ) { if ( elem.removeEventListener ) { elem.removeEventListener( type, handle, false ); } } : function( elem, type, handle ) { var name = "on" + type; if ( elem.detachEvent ) { // #8545, #7054, preventing memory leaks for custom events in IE6-8 // detachEvent needed property on element, by name of that event, to properly expose it to GC if ( typeof elem[ name ] === strundefined ) { elem[ name ] = null; } elem.detachEvent( name, handle ); } }; jQuery.Event = function( src, props ) { // Allow instantiation without the 'new' keyword if ( !(this instanceof jQuery.Event) ) { return new jQuery.Event( src, props ); } // Event object if ( src && src.type ) { this.originalEvent = src; this.type = src.type; // Events bubbling up the document may have been marked as prevented // by a handler lower down the tree; reflect the correct value. this.isDefaultPrevented = src.defaultPrevented || src.defaultPrevented === undefined && ( // Support: IE < 9 src.returnValue === false || // Support: Android < 4.0 src.getPreventDefault && src.getPreventDefault() ) ? returnTrue : returnFalse; // Event type } else { this.type = src; } // Put explicitly provided properties onto the event object if ( props ) { jQuery.extend( this, props ); } // Create a timestamp if incoming event doesn't have one this.timeStamp = src && src.timeStamp || jQuery.now(); // Mark it as fixed this[ jQuery.expando ] = true; }; // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding // http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html jQuery.Event.prototype = { isDefaultPrevented: returnFalse, isPropagationStopped: returnFalse, isImmediatePropagationStopped: returnFalse, preventDefault: function() { var e = this.originalEvent; this.isDefaultPrevented = returnTrue; if ( !e ) { return; } // If preventDefault exists, run it on the original event if ( e.preventDefault ) { e.preventDefault(); // Support: IE // Otherwise set the returnValue property of the original event to false } else { e.returnValue = false; } }, stopPropagation: function() { var e = this.originalEvent; this.isPropagationStopped = returnTrue; if ( !e ) { return; } // If stopPropagation exists, run it on the original event if ( e.stopPropagation ) { e.stopPropagation(); } // Support: IE // Set the cancelBubble property of the original event to true e.cancelBubble = true; }, stopImmediatePropagation: function() { this.isImmediatePropagationStopped = returnTrue; this.stopPropagation(); } }; // Create mouseenter/leave events using mouseover/out and event-time checks jQuery.each({ mouseenter: "mouseover", mouseleave: "mouseout" }, function( orig, fix ) { jQuery.event.special[ orig ] = { delegateType: fix, bindType: fix, handle: function( event ) { var ret, target = this, related = event.relatedTarget, handleObj = event.handleObj; // For mousenter/leave call the handler if related is outside the target. // NB: No relatedTarget if the mouse left/entered the browser window if ( !related || (related !== target && !jQuery.contains( target, related )) ) { event.type = handleObj.origType; ret = handleObj.handler.apply( this, arguments ); event.type = fix; } return ret; } }; }); // IE submit delegation if ( !support.submitBubbles ) { jQuery.event.special.submit = { setup: function() { // Only need this for delegated form submit events if ( jQuery.nodeName( this, "form" ) ) { return false; } // Lazy-add a submit handler when a descendant form may potentially be submitted jQuery.event.add( this, "click._submit keypress._submit", function( e ) { // Node name check avoids a VML-related crash in IE (#9807) var elem = e.target, form = jQuery.nodeName( elem, "input" ) || jQuery.nodeName( elem, "button" ) ? elem.form : undefined; if ( form && !jQuery._data( form, "submitBubbles" ) ) { jQuery.event.add( form, "submit._submit", function( event ) { event._submit_bubble = true; }); jQuery._data( form, "submitBubbles", true ); } }); // return undefined since we don't need an event listener }, postDispatch: function( event ) { // If form was submitted by the user, bubble the event up the tree if ( event._submit_bubble ) { delete event._submit_bubble; if ( this.parentNode && !event.isTrigger ) { jQuery.event.simulate( "submit", this.parentNode, event, true ); } } }, teardown: function() { // Only need this for delegated form submit events if ( jQuery.nodeName( this, "form" ) ) { return false; } // Remove delegated handlers; cleanData eventually reaps submit handlers attached above jQuery.event.remove( this, "._submit" ); } }; } // IE change delegation and checkbox/radio fix if ( !support.changeBubbles ) { jQuery.event.special.change = { setup: function() { if ( rformElems.test( this.nodeName ) ) { // IE doesn't fire change on a check/radio until blur; trigger it on click // after a propertychange. Eat the blur-change in special.change.handle. // This still fires onchange a second time for check/radio after blur. if ( this.type === "checkbox" || this.type === "radio" ) { jQuery.event.add( this, "propertychange._change", function( event ) { if ( event.originalEvent.propertyName === "checked" ) { this._just_changed = true; } }); jQuery.event.add( this, "click._change", function( event ) { if ( this._just_changed && !event.isTrigger ) { this._just_changed = false; } // Allow triggered, simulated change events (#11500) jQuery.event.simulate( "change", this, event, true ); }); } return false; } // Delegated event; lazy-add a change handler on descendant inputs jQuery.event.add( this, "beforeactivate._change", function( e ) { var elem = e.target; if ( rformElems.test( elem.nodeName ) && !jQuery._data( elem, "changeBubbles" ) ) { jQuery.event.add( elem, "change._change", function( event ) { if ( this.parentNode && !event.isSimulated && !event.isTrigger ) { jQuery.event.simulate( "change", this.parentNode, event, true ); } }); jQuery._data( elem, "changeBubbles", true ); } }); }, handle: function( event ) { var elem = event.target; // Swallow native change events from checkbox/radio, we already triggered them above if ( this !== elem || event.isSimulated || event.isTrigger || (elem.type !== "radio" && elem.type !== "checkbox") ) { return event.handleObj.handler.apply( this, arguments ); } }, teardown: function() { jQuery.event.remove( this, "._change" ); return !rformElems.test( this.nodeName ); } }; } // Create "bubbling" focus and blur events if ( !support.focusinBubbles ) { jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) { // Attach a single capturing handler on the document while someone wants focusin/focusout var handler = function( event ) { jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ), true ); }; jQuery.event.special[ fix ] = { setup: function() { var doc = this.ownerDocument || this, attaches = jQuery._data( doc, fix ); if ( !attaches ) { doc.addEventListener( orig, handler, true ); } jQuery._data( doc, fix, ( attaches || 0 ) + 1 ); }, teardown: function() { var doc = this.ownerDocument || this, attaches = jQuery._data( doc, fix ) - 1; if ( !attaches ) { doc.removeEventListener( orig, handler, true ); jQuery._removeData( doc, fix ); } else { jQuery._data( doc, fix, attaches ); } } }; }); } jQuery.fn.extend({ on: function( types, selector, data, fn, /*INTERNAL*/ one ) { var type, origFn; // Types can be a map of types/handlers if ( typeof types === "object" ) { // ( types-Object, selector, data ) if ( typeof selector !== "string" ) { // ( types-Object, data ) data = data || selector; selector = undefined; } for ( type in types ) { this.on( type, selector, data, types[ type ], one ); } return this; } if ( data == null && fn == null ) { // ( types, fn ) fn = selector; data = selector = undefined; } else if ( fn == null ) { if ( typeof selector === "string" ) { // ( types, selector, fn ) fn = data; data = undefined; } else { // ( types, data, fn ) fn = data; data = selector; selector = undefined; } } if ( fn === false ) { fn = returnFalse; } else if ( !fn ) { return this; } if ( one === 1 ) { origFn = fn; fn = function( event ) { // Can use an empty set, since event contains the info jQuery().off( event ); return origFn.apply( this, arguments ); }; // Use same guid so caller can remove using origFn fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ ); } return this.each( function() { jQuery.event.add( this, types, fn, data, selector ); }); }, one: function( types, selector, data, fn ) { return this.on( types, selector, data, fn, 1 ); }, off: function( types, selector, fn ) { var handleObj, type; if ( types && types.preventDefault && types.handleObj ) { // ( event ) dispatched jQuery.Event handleObj = types.handleObj; jQuery( types.delegateTarget ).off( handleObj.namespace ? handleObj.origType + "." + handleObj.namespace : handleObj.origType, handleObj.selector, handleObj.handler ); return this; } if ( typeof types === "object" ) { // ( types-object [, selector] ) for ( type in types ) { this.off( type, selector, types[ type ] ); } return this; } if ( selector === false || typeof selector === "function" ) { // ( types [, fn] ) fn = selector; selector = undefined; } if ( fn === false ) { fn = returnFalse; } return this.each(function() { jQuery.event.remove( this, types, fn, selector ); }); }, trigger: function( type, data ) { return this.each(function() { jQuery.event.trigger( type, data, this ); }); }, triggerHandler: function( type, data ) { var elem = this[0]; if ( elem ) { return jQuery.event.trigger( type, data, elem, true ); } } }); function createSafeFragment( document ) { var list = nodeNames.split( "|" ), safeFrag = document.createDocumentFragment(); if ( safeFrag.createElement ) { while ( list.length ) { safeFrag.createElement( list.pop() ); } } return safeFrag; } var nodeNames = "abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|" + "header|hgroup|mark|meter|nav|output|progress|section|summary|time|video", rinlinejQuery = / jQuery\d+="(?:null|\d+)"/g, rnoshimcache = new RegExp("<(?:" + nodeNames + ")[\\s/>]", "i"), rleadingWhitespace = /^\s+/, rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi, rtagName = /<([\w:]+)/, rtbody = /\s*$/g, // We have to close these tags to support XHTML (#13200) wrapMap = { option: [ 1, "" ], legend: [ 1, "
", "
" ], area: [ 1, "", "" ], param: [ 1, "", "" ], thead: [ 1, "", "
" ], tr: [ 2, "", "
" ], col: [ 2, "", "
" ], td: [ 3, "", "
" ], // IE6-8 can't serialize link, script, style, or any html5 (NoScope) tags, // unless wrapped in a div with non-breaking characters in front of it. _default: support.htmlSerialize ? [ 0, "", "" ] : [ 1, "X
", "
" ] }, safeFragment = createSafeFragment( document ), fragmentDiv = safeFragment.appendChild( document.createElement("div") ); wrapMap.optgroup = wrapMap.option; wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; wrapMap.th = wrapMap.td; function getAll( context, tag ) { var elems, elem, i = 0, found = typeof context.getElementsByTagName !== strundefined ? context.getElementsByTagName( tag || "*" ) : typeof context.querySelectorAll !== strundefined ? context.querySelectorAll( tag || "*" ) : undefined; if ( !found ) { for ( found = [], elems = context.childNodes || context; (elem = elems[i]) != null; i++ ) { if ( !tag || jQuery.nodeName( elem, tag ) ) { found.push( elem ); } else { jQuery.merge( found, getAll( elem, tag ) ); } } } return tag === undefined || tag && jQuery.nodeName( context, tag ) ? jQuery.merge( [ context ], found ) : found; } // Used in buildFragment, fixes the defaultChecked property function fixDefaultChecked( elem ) { if ( rcheckableType.test( elem.type ) ) { elem.defaultChecked = elem.checked; } } // Support: IE<8 // Manipulating tables requires a tbody function manipulationTarget( elem, content ) { return jQuery.nodeName( elem, "table" ) && jQuery.nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ? elem.getElementsByTagName("tbody")[0] || elem.appendChild( elem.ownerDocument.createElement("tbody") ) : elem; } // Replace/restore the type attribute of script elements for safe DOM manipulation function disableScript( elem ) { elem.type = (jQuery.find.attr( elem, "type" ) !== null) + "/" + elem.type; return elem; } function restoreScript( elem ) { var match = rscriptTypeMasked.exec( elem.type ); if ( match ) { elem.type = match[1]; } else { elem.removeAttribute("type"); } return elem; } // Mark scripts as having already been evaluated function setGlobalEval( elems, refElements ) { var elem, i = 0; for ( ; (elem = elems[i]) != null; i++ ) { jQuery._data( elem, "globalEval", !refElements || jQuery._data( refElements[i], "globalEval" ) ); } } function cloneCopyEvent( src, dest ) { if ( dest.nodeType !== 1 || !jQuery.hasData( src ) ) { return; } var type, i, l, oldData = jQuery._data( src ), curData = jQuery._data( dest, oldData ), events = oldData.events; if ( events ) { delete curData.handle; curData.events = {}; for ( type in events ) { for ( i = 0, l = events[ type ].length; i < l; i++ ) { jQuery.event.add( dest, type, events[ type ][ i ] ); } } } // make the cloned public data object a copy from the original if ( curData.data ) { curData.data = jQuery.extend( {}, curData.data ); } } function fixCloneNodeIssues( src, dest ) { var nodeName, e, data; // We do not need to do anything for non-Elements if ( dest.nodeType !== 1 ) { return; } nodeName = dest.nodeName.toLowerCase(); // IE6-8 copies events bound via attachEvent when using cloneNode. if ( !support.noCloneEvent && dest[ jQuery.expando ] ) { data = jQuery._data( dest ); for ( e in data.events ) { jQuery.removeEvent( dest, e, data.handle ); } // Event data gets referenced instead of copied if the expando gets copied too dest.removeAttribute( jQuery.expando ); } // IE blanks contents when cloning scripts, and tries to evaluate newly-set text if ( nodeName === "script" && dest.text !== src.text ) { disableScript( dest ).text = src.text; restoreScript( dest ); // IE6-10 improperly clones children of object elements using classid. // IE10 throws NoModificationAllowedError if parent is null, #12132. } else if ( nodeName === "object" ) { if ( dest.parentNode ) { dest.outerHTML = src.outerHTML; } // This path appears unavoidable for IE9. When cloning an object // element in IE9, the outerHTML strategy above is not sufficient. // If the src has innerHTML and the destination does not, // copy the src.innerHTML into the dest.innerHTML. #10324 if ( support.html5Clone && ( src.innerHTML && !jQuery.trim(dest.innerHTML) ) ) { dest.innerHTML = src.innerHTML; } } else if ( nodeName === "input" && rcheckableType.test( src.type ) ) { // IE6-8 fails to persist the checked state of a cloned checkbox // or radio button. Worse, IE6-7 fail to give the cloned element // a checked appearance if the defaultChecked value isn't also set dest.defaultChecked = dest.checked = src.checked; // IE6-7 get confused and end up setting the value of a cloned // checkbox/radio button to an empty string instead of "on" if ( dest.value !== src.value ) { dest.value = src.value; } // IE6-8 fails to return the selected option to the default selected // state when cloning options } else if ( nodeName === "option" ) { dest.defaultSelected = dest.selected = src.defaultSelected; // IE6-8 fails to set the defaultValue to the correct value when // cloning other types of input fields } else if ( nodeName === "input" || nodeName === "textarea" ) { dest.defaultValue = src.defaultValue; } } jQuery.extend({ clone: function( elem, dataAndEvents, deepDataAndEvents ) { var destElements, node, clone, i, srcElements, inPage = jQuery.contains( elem.ownerDocument, elem ); if ( support.html5Clone || jQuery.isXMLDoc(elem) || !rnoshimcache.test( "<" + elem.nodeName + ">" ) ) { clone = elem.cloneNode( true ); // IE<=8 does not properly clone detached, unknown element nodes } else { fragmentDiv.innerHTML = elem.outerHTML; fragmentDiv.removeChild( clone = fragmentDiv.firstChild ); } if ( (!support.noCloneEvent || !support.noCloneChecked) && (elem.nodeType === 1 || elem.nodeType === 11) && !jQuery.isXMLDoc(elem) ) { // We eschew Sizzle here for performance reasons: http://jsperf.com/getall-vs-sizzle/2 destElements = getAll( clone ); srcElements = getAll( elem ); // Fix all IE cloning issues for ( i = 0; (node = srcElements[i]) != null; ++i ) { // Ensure that the destination node is not null; Fixes #9587 if ( destElements[i] ) { fixCloneNodeIssues( node, destElements[i] ); } } } // Copy the events from the original to the clone if ( dataAndEvents ) { if ( deepDataAndEvents ) { srcElements = srcElements || getAll( elem ); destElements = destElements || getAll( clone ); for ( i = 0; (node = srcElements[i]) != null; i++ ) { cloneCopyEvent( node, destElements[i] ); } } else { cloneCopyEvent( elem, clone ); } } // Preserve script evaluation history destElements = getAll( clone, "script" ); if ( destElements.length > 0 ) { setGlobalEval( destElements, !inPage && getAll( elem, "script" ) ); } destElements = srcElements = node = null; // Return the cloned set return clone; }, buildFragment: function( elems, context, scripts, selection ) { var j, elem, contains, tmp, tag, tbody, wrap, l = elems.length, // Ensure a safe fragment safe = createSafeFragment( context ), nodes = [], i = 0; for ( ; i < l; i++ ) { elem = elems[ i ]; if ( elem || elem === 0 ) { // Add nodes directly if ( jQuery.type( elem ) === "object" ) { jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem ); // Convert non-html into a text node } else if ( !rhtml.test( elem ) ) { nodes.push( context.createTextNode( elem ) ); // Convert html into DOM nodes } else { tmp = tmp || safe.appendChild( context.createElement("div") ); // Deserialize a standard representation tag = (rtagName.exec( elem ) || [ "", "" ])[ 1 ].toLowerCase(); wrap = wrapMap[ tag ] || wrapMap._default; tmp.innerHTML = wrap[1] + elem.replace( rxhtmlTag, "<$1>" ) + wrap[2]; // Descend through wrappers to the right content j = wrap[0]; while ( j-- ) { tmp = tmp.lastChild; } // Manually add leading whitespace removed by IE if ( !support.leadingWhitespace && rleadingWhitespace.test( elem ) ) { nodes.push( context.createTextNode( rleadingWhitespace.exec( elem )[0] ) ); } // Remove IE's autoinserted from table fragments if ( !support.tbody ) { // String was a , *may* have spurious elem = tag === "table" && !rtbody.test( elem ) ? tmp.firstChild : // String was a bare or wrap[1] === "
" && !rtbody.test( elem ) ? tmp : 0; j = elem && elem.childNodes.length; while ( j-- ) { if ( jQuery.nodeName( (tbody = elem.childNodes[j]), "tbody" ) && !tbody.childNodes.length ) { elem.removeChild( tbody ); } } } jQuery.merge( nodes, tmp.childNodes ); // Fix #12392 for WebKit and IE > 9 tmp.textContent = ""; // Fix #12392 for oldIE while ( tmp.firstChild ) { tmp.removeChild( tmp.firstChild ); } // Remember the top-level container for proper cleanup tmp = safe.lastChild; } } } // Fix #11356: Clear elements from fragment if ( tmp ) { safe.removeChild( tmp ); } // Reset defaultChecked for any radios and checkboxes // about to be appended to the DOM in IE 6/7 (#8060) if ( !support.appendChecked ) { jQuery.grep( getAll( nodes, "input" ), fixDefaultChecked ); } i = 0; while ( (elem = nodes[ i++ ]) ) { // #4087 - If origin and destination elements are the same, and this is // that element, do not do anything if ( selection && jQuery.inArray( elem, selection ) !== -1 ) { continue; } contains = jQuery.contains( elem.ownerDocument, elem ); // Append to fragment tmp = getAll( safe.appendChild( elem ), "script" ); // Preserve script evaluation history if ( contains ) { setGlobalEval( tmp ); } // Capture executables if ( scripts ) { j = 0; while ( (elem = tmp[ j++ ]) ) { if ( rscriptType.test( elem.type || "" ) ) { scripts.push( elem ); } } } } tmp = null; return safe; }, cleanData: function( elems, /* internal */ acceptData ) { var elem, type, id, data, i = 0, internalKey = jQuery.expando, cache = jQuery.cache, deleteExpando = support.deleteExpando, special = jQuery.event.special; for ( ; (elem = elems[i]) != null; i++ ) { if ( acceptData || jQuery.acceptData( elem ) ) { id = elem[ internalKey ]; data = id && cache[ id ]; if ( data ) { if ( data.events ) { for ( type in data.events ) { if ( special[ type ] ) { jQuery.event.remove( elem, type ); // This is a shortcut to avoid jQuery.event.remove's overhead } else { jQuery.removeEvent( elem, type, data.handle ); } } } // Remove cache only if it was not already removed by jQuery.event.remove if ( cache[ id ] ) { delete cache[ id ]; // IE does not allow us to delete expando properties from nodes, // nor does it have a removeAttribute function on Document nodes; // we must handle all of these cases if ( deleteExpando ) { delete elem[ internalKey ]; } else if ( typeof elem.removeAttribute !== strundefined ) { elem.removeAttribute( internalKey ); } else { elem[ internalKey ] = null; } deletedIds.push( id ); } } } } } }); jQuery.fn.extend({ text: function( value ) { return access( this, function( value ) { return value === undefined ? jQuery.text( this ) : this.empty().append( ( this[0] && this[0].ownerDocument || document ).createTextNode( value ) ); }, null, value, arguments.length ); }, append: function() { return this.domManip( arguments, function( elem ) { if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { var target = manipulationTarget( this, elem ); target.appendChild( elem ); } }); }, prepend: function() { return this.domManip( arguments, function( elem ) { if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { var target = manipulationTarget( this, elem ); target.insertBefore( elem, target.firstChild ); } }); }, before: function() { return this.domManip( arguments, function( elem ) { if ( this.parentNode ) { this.parentNode.insertBefore( elem, this ); } }); }, after: function() { return this.domManip( arguments, function( elem ) { if ( this.parentNode ) { this.parentNode.insertBefore( elem, this.nextSibling ); } }); }, remove: function( selector, keepData /* Internal Use Only */ ) { var elem, elems = selector ? jQuery.filter( selector, this ) : this, i = 0; for ( ; (elem = elems[i]) != null; i++ ) { if ( !keepData && elem.nodeType === 1 ) { jQuery.cleanData( getAll( elem ) ); } if ( elem.parentNode ) { if ( keepData && jQuery.contains( elem.ownerDocument, elem ) ) { setGlobalEval( getAll( elem, "script" ) ); } elem.parentNode.removeChild( elem ); } } return this; }, empty: function() { var elem, i = 0; for ( ; (elem = this[i]) != null; i++ ) { // Remove element nodes and prevent memory leaks if ( elem.nodeType === 1 ) { jQuery.cleanData( getAll( elem, false ) ); } // Remove any remaining nodes while ( elem.firstChild ) { elem.removeChild( elem.firstChild ); } // If this is a select, ensure that it displays empty (#12336) // Support: IE<9 if ( elem.options && jQuery.nodeName( elem, "select" ) ) { elem.options.length = 0; } } return this; }, clone: function( dataAndEvents, deepDataAndEvents ) { dataAndEvents = dataAndEvents == null ? false : dataAndEvents; deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents; return this.map(function() { return jQuery.clone( this, dataAndEvents, deepDataAndEvents ); }); }, html: function( value ) { return access( this, function( value ) { var elem = this[ 0 ] || {}, i = 0, l = this.length; if ( value === undefined ) { return elem.nodeType === 1 ? elem.innerHTML.replace( rinlinejQuery, "" ) : undefined; } // See if we can take a shortcut and just use innerHTML if ( typeof value === "string" && !rnoInnerhtml.test( value ) && ( support.htmlSerialize || !rnoshimcache.test( value ) ) && ( support.leadingWhitespace || !rleadingWhitespace.test( value ) ) && !wrapMap[ (rtagName.exec( value ) || [ "", "" ])[ 1 ].toLowerCase() ] ) { value = value.replace( rxhtmlTag, "<$1>" ); try { for (; i < l; i++ ) { // Remove element nodes and prevent memory leaks elem = this[i] || {}; if ( elem.nodeType === 1 ) { jQuery.cleanData( getAll( elem, false ) ); elem.innerHTML = value; } } elem = 0; // If using innerHTML throws an exception, use the fallback method } catch(e) {} } if ( elem ) { this.empty().append( value ); } }, null, value, arguments.length ); }, replaceWith: function() { var arg = arguments[ 0 ]; // Make the changes, replacing each context element with the new content this.domManip( arguments, function( elem ) { arg = this.parentNode; jQuery.cleanData( getAll( this ) ); if ( arg ) { arg.replaceChild( elem, this ); } }); // Force removal if there was no new content (e.g., from empty arguments) return arg && (arg.length || arg.nodeType) ? this : this.remove(); }, detach: function( selector ) { return this.remove( selector, true ); }, domManip: function( args, callback ) { // Flatten any nested arrays args = concat.apply( [], args ); var first, node, hasScripts, scripts, doc, fragment, i = 0, l = this.length, set = this, iNoClone = l - 1, value = args[0], isFunction = jQuery.isFunction( value ); // We can't cloneNode fragments that contain checked, in WebKit if ( isFunction || ( l > 1 && typeof value === "string" && !support.checkClone && rchecked.test( value ) ) ) { return this.each(function( index ) { var self = set.eq( index ); if ( isFunction ) { args[0] = value.call( this, index, self.html() ); } self.domManip( args, callback ); }); } if ( l ) { fragment = jQuery.buildFragment( args, this[ 0 ].ownerDocument, false, this ); first = fragment.firstChild; if ( fragment.childNodes.length === 1 ) { fragment = first; } if ( first ) { scripts = jQuery.map( getAll( fragment, "script" ), disableScript ); hasScripts = scripts.length; // Use the original fragment for the last item instead of the first because it can end up // being emptied incorrectly in certain situations (#8070). for ( ; i < l; i++ ) { node = fragment; if ( i !== iNoClone ) { node = jQuery.clone( node, true, true ); // Keep references to cloned scripts for later restoration if ( hasScripts ) { jQuery.merge( scripts, getAll( node, "script" ) ); } } callback.call( this[i], node, i ); } if ( hasScripts ) { doc = scripts[ scripts.length - 1 ].ownerDocument; // Reenable scripts jQuery.map( scripts, restoreScript ); // Evaluate executable scripts on first document insertion for ( i = 0; i < hasScripts; i++ ) { node = scripts[ i ]; if ( rscriptType.test( node.type || "" ) && !jQuery._data( node, "globalEval" ) && jQuery.contains( doc, node ) ) { if ( node.src ) { // Optional AJAX dependency, but won't run scripts if not present if ( jQuery._evalUrl ) { jQuery._evalUrl( node.src ); } } else { jQuery.globalEval( ( node.text || node.textContent || node.innerHTML || "" ).replace( rcleanScript, "" ) ); } } } } // Fix #11809: Avoid leaking memory fragment = first = null; } } return this; } }); jQuery.each({ appendTo: "append", prependTo: "prepend", insertBefore: "before", insertAfter: "after", replaceAll: "replaceWith" }, function( name, original ) { jQuery.fn[ name ] = function( selector ) { var elems, i = 0, ret = [], insert = jQuery( selector ), last = insert.length - 1; for ( ; i <= last; i++ ) { elems = i === last ? this : this.clone(true); jQuery( insert[i] )[ original ]( elems ); // Modern browsers can apply jQuery collections as arrays, but oldIE needs a .get() push.apply( ret, elems.get() ); } return this.pushStack( ret ); }; }); var iframe, elemdisplay = {}; /** * Retrieve the actual display of a element * @param {String} name nodeName of the element * @param {Object} doc Document object */ // Called only from within defaultDisplay function actualDisplay( name, doc ) { var elem = jQuery( doc.createElement( name ) ).appendTo( doc.body ), // getDefaultComputedStyle might be reliably used only on attached element display = window.getDefaultComputedStyle ? // Use of this method is a temporary fix (more like optmization) until something better comes along, // since it was removed from specification and supported only in FF window.getDefaultComputedStyle( elem[ 0 ] ).display : jQuery.css( elem[ 0 ], "display" ); // We don't have any data stored on the element, // so use "detach" method as fast way to get rid of the element elem.detach(); return display; } /** * Try to determine the default display value of an element * @param {String} nodeName */ function defaultDisplay( nodeName ) { var doc = document, display = elemdisplay[ nodeName ]; if ( !display ) { display = actualDisplay( nodeName, doc ); // If the simple way fails, read from inside an iframe if ( display === "none" || !display ) { // Use the already-created iframe if possible iframe = (iframe || jQuery( " jsdom-19.0.0/test/to-port-to-wpts/files/image.png000066400000000000000000000044301415223704400216100ustar00rootroot00000000000000PNG  IHDRCUtEXtSoftwareAdobe ImageReadyqe<xiTXtXML:com.adobe.xmp PPLTEݠ TT겲SPuu@@@RR&"ԇCC""!,,0-rptRNSab^IDATxS@p " "D{p;昹d˘?2~[ 辩uC\:@P@ P@P@BՀ\ (*  K eX-4|y<]H1 woE[{^\lPd MB2]^8 Fy?"餐ȿO@COBl N78o;"UZ ORR Bj/olưu<k?!3,H#mX4yFnPw_""|۸zt~Tp; tt p^`g%ݮӹyCwxjsccwC%#< jsdom-19.0.0/test/to-port-to-wpts/files/ns-html.html000066400000000000000000000001161415223704400222650ustar00rootroot00000000000000

jsdom-19.0.0/test/to-port-to-wpts/files/ns-svg.html000066400000000000000000000001301415223704400221140ustar00rootroot00000000000000 jsdom-19.0.0/test/to-port-to-wpts/files/parent-node.html000066400000000000000000000003211415223704400231150ustar00rootroot00000000000000 ParentNode hi
jsdom-19.0.0/test/to-port-to-wpts/files/simple_iframe.html000066400000000000000000000001541415223704400235210ustar00rootroot00000000000000
Initial Text
jsdom-19.0.0/test/to-port-to-wpts/files/steam.html000066400000000000000000000021651415223704400220220ustar00rootroot00000000000000 Steam Community :: Steam Badges :: Wooden Sen'SeY
<3luv<3
Old Dude > Sen'SeY
jsdom-19.0.0/test/to-port-to-wpts/files/test.html000066400000000000000000000003441415223704400216650ustar00rootroot00000000000000 Minimal Hello!Goodbye!Hello Again

This is an Important paragraph

jsdom-19.0.0/test/to-port-to-wpts/files/timer_in_context.js000066400000000000000000000000601415223704400237230ustar00rootroot00000000000000x = 0; setTimeout(function () { x = 1; }, 0); jsdom-19.0.0/test/to-port-to-wpts/files/xml.xml000066400000000000000000000002541415223704400213420ustar00rootroot00000000000000 T a jsdom-19.0.0/test/to-port-to-wpts/frame.js000066400000000000000000000463131415223704400203540ustar00rootroot00000000000000var path = require('path'); var fs = require('fs'); const { assert } = require("chai"); const { describe, specify } = require("mocha-sugar-free"); const { JSDOM } = require("../.."); var toFileUrl = require('../util.js').toFileUrl(__dirname); describe("frame", { skipIfBrowser: true }, () => { specify('frame_parent', (t) => { var { window } = new JSDOM('\ ', { resources: "usable", runScripts: "dangerously" }); window.iframe.onload = function() { assert.strictEqual(window.DONE, 1); assert.strictEqual(window.PARENT_IS_TOP, true); //insert a script tag to make sure the global set in the iframe is visible //in the parent window context var doc = window.document; var script = doc.createElement('script'); script.textContent = 'results=[aGlobal, DONE, PARENT_IS_TOP]'; doc.body.appendChild(script); //the script is executed asynchronously after insertion to the document, //so setTimeout is needed setTimeout(function(){ assert.deepEqual(window.results, [1, 1, true]); t.done(); }, 0); }; }, { async: true }); specify('frame_src_relative_to_parent_doc', (t) => { var { window } = new JSDOM('\ \ ', { url: toFileUrl("test.html"), resources: "usable", runScripts: "dangerously" }); window.document.onload = function(){ assert.strictEqual(window.LOADED_FRAME, 1); assert.strictEqual(window.PARENT_IS_TOP, true); t.done(); }; }, { async: true }); specify('test iframe element existence', () => { var iframeParentPath = path.resolve(__dirname, 'files', 'iframe_parent.html'); var { window } = new JSDOM(fs.readFileSync(iframeParentPath, 'utf8'), { resources: "usable", url : toFileUrl(__filename) }); var elem = window.document.getElementById('simpleIFrameID'); assert.notEqual(elem, null); assert.equal(elem.name, 'simpleIFrame'); assert.equal(elem.id, 'simpleIFrameID'); }); specify('test iframe.contentDocument access', (t) => { var iframeParentPath = path.resolve(__dirname, 'files', 'iframe_parent.html'); var { window } = new JSDOM(fs.readFileSync(iframeParentPath, 'utf8'), { resources: "usable", url : toFileUrl(__filename) }); window.document.addEventListener('load', function () { var iframeElem = window.document.getElementById('simpleIFrameID'); assert.notEqual(iframeElem, null); var iframeDoc = iframeElem.contentDocument; assert.notEqual(iframeDoc, null); assert.notStrictEqual(iframeDoc, window.document); var iframeDiv = iframeDoc.getElementById('iframeDiv'); assert.notEqual(iframeDiv, null); assert.equal(iframeDiv.innerHTML, "Initial Text"); t.done(); }); }, { async: true }); specify('test iframe load event', (t) => { var { window } = new JSDOM(``, { resources: "usable", url : toFileUrl(__filename) }); var iFrame = window.document.createElement('iframe'); iFrame.addEventListener('load', function () { assert.notEqual(iFrame.contentDocument, null); t.done(); }); iFrame.src = 'files/simple_iframe.html'; // Must insert into doc to force load. window.document.documentElement.appendChild(iFrame); }, { async: true }); specify('iframe loads blank document when src unspecified', (t) => { var doc = (new JSDOM(``, { resources: "usable" })).window.document; var iFrame = doc.createElement('iframe'); iFrame.addEventListener('load', function () { assert.notEqual(iFrame.contentDocument, null); assert.strictEqual(iFrame.contentDocument.readyState, 'complete'); t.done(); }); doc.documentElement.appendChild(iFrame); }, { async: true }); specify('test iframe.contentWindow acccess', (t) => { var htmlPath = path.resolve(__dirname, 'files', 'iframe_parent.html'); var { window } = new JSDOM(fs.readFileSync(htmlPath, 'utf8'), { resources: "usable", url : toFileUrl(__filename) }); window.document.addEventListener('load', function () { var iframeElem = window.document.getElementById('simpleIFrameID'); assert.notEqual(iframeElem, null); var iframeDoc = iframeElem.contentDocument; assert.notEqual(iframeDoc, null); var iframeWindow = iframeElem.contentWindow; assert.notStrictEqual(iframeWindow, window.document.defaultView); assert.equal(iframeWindow, iframeDoc.defaultView); t.done(); }); }, { async: true }); specify('get iframe window via indexed frames access', (t) => { var htmlPath = path.resolve(__dirname, 'files', 'iframe_parent.html'); var { window } = new JSDOM(fs.readFileSync(htmlPath, 'utf8'), { resources: "usable", url : toFileUrl(__filename) }); window.document.addEventListener('load', function () { var iframeWindow = window.frames[0]; assert.notEqual(iframeWindow, null); assert.notStrictEqual(iframeWindow, window); assert.strictEqual(iframeWindow.parent, window); var iframeDoc = iframeWindow.document; assert.notStrictEqual(iframeWindow.document, window.document); assert.strictEqual(iframeWindow.document, iframeDoc); assert.notEqual(iframeWindow.document.getElementById('iframeDiv'), null); t.done(); }); }, { async: true }); specify('get iframe window via indexed frames access with setAttributeNode', (t) => { var { window } = new JSDOM("", { resources: "usable", url : toFileUrl(__filename) }); const doc = window.document; var iframe = doc.getElementById('simpleIFrameID'); var attr = doc.createAttribute('src'); attr.value = 'files/simple_iframe.html'; iframe.setAttributeNode(attr); iframe.addEventListener('load', function () { var window = doc.defaultView; var iframeWindow = window.frames[0]; assert.notEqual(iframeWindow, null); assert.notStrictEqual(iframeWindow, window); assert.strictEqual(iframeWindow.parent, window); var iframeDoc = iframeWindow.document; assert.notStrictEqual(iframeWindow.document, window.document); assert.notEqual(iframeWindow.document.getElementById('iframeDiv'), null); t.done(); }); }, { async: true }); specify('update named frames access on name change', (t) => { var htmlPath = path.resolve(__dirname, 'files', 'iframe_parent.html'); var doc = (new JSDOM(fs.readFileSync(htmlPath, 'utf8'), { resources: "usable", url : toFileUrl(__filename) })).window.document; doc.addEventListener('load', function () { var window = doc.defaultView; var iframeWindow = window.frames['simpleIFrame']; assert.notEqual(iframeWindow, null); assert.notStrictEqual(iframeWindow, window); assert.strictEqual(iframeWindow.parent, window); doc.getElementById('simpleIFrameID').setAttribute('name', 'otherSimpleIFrame'); assert.ok(!window.frames['simpleIFrame'], 'remove old named property'); assert.ok(window.frames['otherSimpleIFrame'], 'add new named property'); t.done(); }); }, { async: true }); // See: http://www.whatwg.org/specs/web-apps/current-work/#dom-frames specify('test frames array identity', (t) => { var htmlPath = path.resolve(__dirname, 'files', 'iframe_parent.html'); var doc = (new JSDOM(fs.readFileSync(htmlPath, 'utf8'), { resources: "usable", url : toFileUrl(__filename) })).window.document; doc.addEventListener('load', function () { var window = doc.defaultView; assert.strictEqual(window.frames, window); t.done(); }); }, { async: true }); specify('test nested iframes', (t) => { var htmlPath = path.resolve(__dirname, 'files', 'iframe_parent.html'); var { window } = new JSDOM(fs.readFileSync(htmlPath, 'utf8'), { resources: "usable", url : toFileUrl(__filename) }); const doc = window.document; doc.addEventListener('load', function () { var topIFrameElem = doc.getElementById('simpleIFrameID'); var topIFrameDoc = topIFrameElem.contentDocument; var topIFrameWindow = topIFrameElem.contentWindow; var bottomIFrameElem = topIFrameDoc.createElement('iframe'); bottomIFrameElem.addEventListener('load', function () { var bottomIFrameDoc = bottomIFrameElem.contentDocument; assert.notEqual(bottomIFrameDoc, null); var bottomIFrameWindow = bottomIFrameDoc.defaultView; assert.notEqual(bottomIFrameWindow, null); // The real tests assert.strictEqual(bottomIFrameWindow.parent, topIFrameWindow); assert.strictEqual(bottomIFrameWindow.top, window); assert.strictEqual(topIFrameWindow.parent, window); assert.strictEqual(topIFrameWindow.top, window); assert.strictEqual(window.frames[0], topIFrameWindow); assert.strictEqual(topIFrameWindow.frames[0], bottomIFrameWindow); t.done(); }); bottomIFrameElem.src = 'simple_iframe.html'; topIFrameDoc.documentElement.appendChild(bottomIFrameElem); }); }, { async: true }); specify('test multiple iframes', (t) => { var htmlPath = path.resolve(__dirname, 'files', 'multiple_iframe_parent.html'); var { window } = new JSDOM(fs.readFileSync(htmlPath, 'utf8'), { resources: "usable", url : toFileUrl(__filename) }); var doc = window.document; doc.addEventListener('load', function () { var iframe1 = doc.getElementById('frame1ID'); var iframe2 = doc.getElementById('frame2ID'); var iframe3 = doc.getElementById('frame3ID'); assert.notEqual(window, iframe1.contentWindow); assert.notEqual(window, iframe2.contentWindow); assert.notEqual(window, iframe3.contentWindow); assert.equal(iframe1.contentWindow.parent, window); assert.equal(iframe2.contentWindow.parent, window); assert.equal(iframe3.contentWindow.parent, window); assert.equal(iframe1.contentWindow.top, window); assert.equal(iframe2.contentWindow.top, window); assert.equal(iframe3.contentWindow.top, window); t.done(); }); }, { async: true }); specify('test named lookup', (t) => { var htmlPath = path.resolve(__dirname, 'files', 'multiple_iframe_parent.html'); var { window } = new JSDOM(fs.readFileSync(htmlPath, 'utf8'), { resources: "usable", url : toFileUrl(__filename) }); var doc = window.document; doc.addEventListener('load', function () { var iframe1 = doc.getElementById('frame1ID'); var iframe2 = doc.getElementById('frame2ID'); var iframe3 = doc.getElementById('frame3ID'); assert.equal(window['frame1'], iframe1.contentWindow); assert.equal(window['frame2'], iframe2.contentWindow); assert.equal(window['frame3'], iframe3.contentWindow); t.done(); }); }, { async: true }); // This is based off of a test from the jQuery test suite that was failing. specify('test iframe without src', (t) => { var { window } = new JSDOM(``, { resources: "usable", url : toFileUrl(__filename), runScripts: "dangerously" }); var doc = window.document; window.loaded = function () { assert.equal(window.testVal, 3); t.done(); }; var iframe = doc.createElement('iframe'); doc.body.appendChild(iframe); var iframeDoc = iframe.contentDocument; assert.notEqual(iframeDoc, null); iframeDoc.open(); iframeDoc.write(""); iframeDoc.close(); }, { async: true }); specify('test setting src multiple times', (t) => { var doc = (new JSDOM(null, { resources: "usable", url : toFileUrl(__filename) })).window.document; var iframe = doc.createElement('iframe'); iframe.addEventListener('load', function () { assert.equal(iframe.src, toFileUrl('files/simple_iframe.html')); t.done(); }); iframe.src = 'garbage'; iframe.src = 'files/simple_iframe.html'; doc.body.appendChild(iframe); }, { async: true }); specify('test framesets', (t) => { var htmlPath = path.resolve(__dirname, 'files', 'frameset_parent.html'); var { window } = new JSDOM(fs.readFileSync(htmlPath, 'utf8'), { resources: "usable", url : toFileUrl(htmlPath) }); var doc = window.document; doc.addEventListener('load', function () { var frame1 = doc.getElementById('frame1ID'); var frame2 = doc.getElementById('frame2ID'); assert.notEqual(frame1, null); assert.notEqual(frame2, null); var frame1doc = frame1.contentDocument; var frame2doc = frame2.contentDocument; assert.notEqual(frame1doc, null); assert.notEqual(frame2doc, null); assert.strictEqual(frame1.contentWindow, frame1doc.defaultView); assert.strictEqual(frame2.contentWindow, frame2doc.defaultView); assert.strictEqual(window.frames[0], frame1.contentWindow); assert.strictEqual(window.frames[1], frame2.contentWindow); assert.strictEqual(window.frames['frame1'], frame1.contentWindow); assert.strictEqual(window.frames['frame2'], frame2.contentWindow); assert.equal(window, frame1.contentWindow.parent); assert.equal(window, frame2.contentWindow.parent); t.done(); }); }, { async: true }); specify('test frame references', () => { var { window } = new JSDOM(""); assert.strictEqual(window.length, 1, "frame should exist (.length)"); assert.notEqual(window[0], undefined, "frame should exist (undefined check)"); assert.strictEqual(window[0], window.foo, "index access and name access should return same reference"); }); specify('remove frame', () => { var { window } = new JSDOM(""); assert.strictEqual(window.length, 1, "frame should exist (.length)"); assert.notEqual(window[0], undefined, "frame should exist (undefined check)"); window.document.body.removeChild(window.document.getElementById("myFrame")); assert.strictEqual(window.length, 0, "frame shouldn't exist (.length)"); assert.strictEqual(window[0], undefined, "frame shouldn't exist anymore (idx accessor)"); assert.strictEqual(window.foo, undefined, "frame shouldn't exist anymore (name accessor)"); assert.ok(!('0' in window), "'0' should not be in window anymore"); }); specify('remove middle frame', () => { var { window } = new JSDOM(""+ ""); assert.strictEqual(window.length, 3, "frames should exist (.length)"); assert.notEqual(window[0], undefined, "frame1 should exist (undefined check)"); assert.notEqual(window[1], undefined, "frame2 should exist (undefined check)"); assert.notEqual(window[2], undefined, "frame3 should exist (undefined check)"); window.document.body.removeChild(window.document.getElementById("myFrame2")); assert.strictEqual(window.length, 2, "frame shouldn't exist (.length)"); assert.strictEqual(window[2], undefined, "frame shouldn't exist anymore (idx accessor)"); assert.strictEqual(window.foo2, undefined, "frame shouldn't exist anymore (name accessor)"); assert.strictEqual(window.foo3, window[1], "frame index accessor should be moved down"); window.document.body.removeChild(window.document.getElementById("myFrame1")); assert.strictEqual(window.length, 1, "frame shouldn't exist (.length)"); assert.strictEqual(window[1], undefined, "frame shouldn't exist anymore (idx accessor)"); assert.strictEqual(window.foo1, undefined, "frame shouldn't exist anymore (name accessor)"); assert.strictEqual(window.foo3, window[0], "frame index accessor should be moved down"); }); specify('accessor should not exist before append', () => { var { document } = (new JSDOM()).window; var el = document.createElement("iframe"); el.setAttribute("name", "foo"); assert.strictEqual(document.defaultView.length, 0, "no frames should exist yet"); assert.strictEqual(document.defaultView[0], undefined, "indexed access should fail"); assert.strictEqual(document.defaultView.foo, undefined, "named access should fail"); document.body.appendChild(el); assert.strictEqual(document.defaultView.length, 1, "appended frame should increase window.length"); assert.notEqual(document.defaultView[0], undefined, "indexed access should succeed"); assert.notEqual(document.defaultView.foo, undefined, "named access should succeed"); assert.strictEqual(document.defaultView.foo, document.defaultView[0], "named and indexed access should return same object"); document.body.removeChild(el); assert.strictEqual(document.defaultView.length, 0, "no frames should exist yet"); assert.strictEqual(document.defaultView[0], undefined, "indexed access should fail"); assert.strictEqual(document.defaultView.foo, undefined, "named access should fail"); document.body.appendChild(el); assert.strictEqual(document.defaultView.length, 1, "appended frame should increase window.length"); assert.notEqual(document.defaultView[0], undefined, "indexed access should succeed"); assert.notEqual(document.defaultView.foo, undefined, "named access should succeed"); assert.strictEqual(document.defaultView.foo, document.defaultView[0], "named and indexed access should return same object"); }); specify('move frame', () => { var { window } = new JSDOM(""); var document = window.document; var frame = document.querySelector("iframe"); var beforeFrame = document.createElement("iframe"); beforeFrame.setAttribute("name", "bar"); document.body.insertBefore(beforeFrame, frame); assert.strictEqual(window.length, 2, "should load 2 iframes"); assert.strictEqual(window.bar, window[0], "bar should be first frame"); assert.strictEqual(window.foo, window[1], "foo should be second frame"); }); specify('frame should not be loaded and accessor should not exist until in document, even with a parent node', (t) => { var { window } = new JSDOM("", { url: toFileUrl(__filename) }); var document = window.document; var frame = document.createElement("iframe"); frame.onload = function () { assert.ok(false, "onload should not be called"); }; var parentNode = document.createElement("div"); parentNode.appendChild(frame); frame.src = "files/simple_iframe.html"; frame.setAttribute("name", "foo"); assert.strictEqual(window.length, 0, "window length should be zero (no frames)"); assert.strictEqual(window[0], undefined, "window should not have a 0 property"); assert.strictEqual(window.foo, undefined, "window should not have a property for the iframe name"); setTimeout(function () { t.done(); }, 1000); }, { async: true }); }); jsdom-19.0.0/test/to-port-to-wpts/history.js000066400000000000000000000154451415223704400207650ustar00rootroot00000000000000"use strict"; const { assert } = require("chai"); const { describe, specify } = require("mocha-sugar-free"); const { JSDOM } = require("../.."); describe("history", () => { specify( "a default window should have a history object with correct default values", () => { const { window } = new JSDOM(); assert.ok(window.history); assert.strictEqual(window.history.state, null); assert.strictEqual(window.history.length, 1); } ); specify( "the history object should update correctly when calling pushState/replaceState", () => { const { window } = new JSDOM(``, { url: "http://www.example.org/" }); window.addEventListener("popstate", () => { assert.fail("popstate should not fire as a result of a pushState() or replaceState() call"); }); // Absolute path window.history.pushState({ foo: "one" }, "unused title", "/bar/baz#fuzz"); assert.strictEqual(window.history.length, 2); assert.strictEqual(window.history.state.foo, "one"); assert.strictEqual(window.location.pathname, "/bar/baz"); assert.strictEqual(window.location.hash, "#fuzz"); window.history.pushState({ foo: "two" }, "unused title 2", "/bar/foo#boo"); assert.strictEqual(window.history.length, 3); assert.strictEqual(window.history.state.foo, "two"); assert.strictEqual(window.location.pathname, "/bar/foo"); assert.strictEqual(window.location.hash, "#boo"); // Relative path window.history.pushState({ foo: "three" }, "unused title 3", "fizz"); assert.strictEqual(window.history.length, 4); assert.strictEqual(window.history.state.foo, "three"); assert.strictEqual(window.location.pathname, "/bar/fizz"); assert.strictEqual(window.location.hash, ""); window.history.replaceState({ foo: "four" }, "unused title 4", "/buzz"); assert.strictEqual(window.history.length, 4); assert.strictEqual(window.history.state.foo, "four"); assert.strictEqual(window.location.pathname, "/buzz"); } ); specify( "the history object should update correctly when calling forward/back/go", t => { const { window } = new JSDOM(``, { url: "http://www.example.org/" }); const initialPath = window.location.pathname; [ [{ foo: "bar" }, "title 1", "/bar"], [{ foo: "baz" }, "title 2", "/baz"], [{ foo: "buzz" }, "title 3", "/buzz"] ].forEach(args => { window.history.pushState(...args); }); // Sanity check assert.strictEqual(window.history.length, 4); assert.strictEqual(window.history.state.foo, "buzz"); assert.strictEqual(window.location.pathname, "/buzz"); // Test forward boundary window.history.forward(); assert.strictEqual(window.history.length, 4); assert.strictEqual(window.history.state.foo, "buzz"); assert.strictEqual(window.location.pathname, "/buzz"); window.history.back(); assert.strictEqual(window.history.length, 4); // Should not change immediately. assert.strictEqual(window.history.state.foo, "buzz"); assert.strictEqual(window.location.pathname, "/buzz"); setTimeout(() => { // Should not even change after one task! assert.strictEqual(window.history.state.foo, "buzz"); assert.strictEqual(window.location.pathname, "/buzz"); setTimeout(() => { // It takes two tasks to change! assert.strictEqual(window.history.state.foo, "baz"); assert.strictEqual(window.location.pathname, "/baz"); // From hereon out we just assume this is correct and wait for it. window.history.back(); waitForHistoryChange(() => { assert.strictEqual(window.history.length, 4); assert.strictEqual(window.history.state.foo, "bar"); assert.strictEqual(window.location.pathname, "/bar"); window.history.back(); waitForHistoryChange(() => { assert.strictEqual(window.history.length, 4); assert.strictEqual(window.history.state, null); assert.strictEqual(window.location.pathname, initialPath); // Test backward boundary window.history.back(); waitForHistoryChange(() => { assert.strictEqual(window.history.length, 4); assert.strictEqual(window.history.state, null); assert.strictEqual(window.location.pathname, initialPath); window.history.go(2); waitForHistoryChange(() => { assert.strictEqual(window.history.length, 4); assert.strictEqual(window.history.state.foo, "baz"); assert.strictEqual(window.location.pathname, "/baz"); t.done(); }); }); }); }); }, 0); }, 0); }, { async: true } ); specify( "the history object should update correctly when calling pushState with index behind length", t => { const { window } = new JSDOM(``, { url: "http://www.example.org/" }); [ [{ foo: "bar" }, "title 1", "/bar"], [{ foo: "baz" }, "title 2", "/baz"], [{ foo: "buzz" }, "title 3", "/buzz"] ].forEach(args => { window.history.pushState(...args); }); // Sanity check assert.strictEqual(window.history.length, 4); assert.strictEqual(window.history.state.foo, "buzz"); assert.strictEqual(window.location.pathname, "/buzz"); window.history.go(-2); waitForHistoryChange(() => { assert.strictEqual(window.history.length, 4); assert.strictEqual(window.history.state.foo, "bar"); assert.strictEqual(window.location.pathname, "/bar"); // Call pushState when index is behind length window.history.pushState({ foo: "bar-b" }, "title 2b", "/bar/b"); assert.strictEqual(window.history.length, 3); assert.strictEqual(window.history.state.foo, "bar-b"); assert.strictEqual(window.location.pathname, "/bar/b"); t.done(); }); }, { async: true } ); specify( "the history object should fire popstate on the window while navigating the history", t => { const { window } = new JSDOM(``, { url: "http://www.example.org/" }); const state = { foo: "bar" }; window.addEventListener("popstate", event => { assert.strictEqual(event.bubbles, false); assert.strictEqual(event.cancelable, false); assert.strictEqual(event.state, state); t.done(); }); window.history.pushState(state, "title", "bar"); window.history.pushState(null, "", "baz"); window.history.back(); }, { async: true } ); function waitForHistoryChange(fn) { // See notes above. setTimeout(() => setTimeout(fn, 0), 0); } }); jsdom-19.0.0/test/to-port-to-wpts/htmlanchorelement.js000066400000000000000000000011411415223704400227610ustar00rootroot00000000000000"use strict"; const { assert } = require("chai"); const { describe, specify } = require("mocha-sugar-free"); const { JSDOM } = require("../.."); describe("htmlanchorelement", () => { specify("relative URLs resolved relative to file base URLs (GH-1141)", () => { const { window } = new JSDOM(`onetwo`, { url: "file:///base/path.html" }); assert.strictEqual(window.document.querySelector("#one").href, "file:///foo.pdf"); assert.strictEqual(window.document.querySelector("#two").href, "file:///base/foo.pdf"); }); }); jsdom-19.0.0/test/to-port-to-wpts/htmlcanvaselement.js000066400000000000000000000135651415223704400227770ustar00rootroot00000000000000"use strict"; const fs = require("fs"); const path = require("path"); const parseDataURL = require("data-urls"); const { assert } = require("chai"); const { describe, specify } = require("mocha-sugar-free"); const { PNG } = require("pngjs"); const { JSDOM } = require("../.."); const { isCanvasInstalled } = require("../util.js"); // Tests for the HTML canvas element // Spec: https://html.spec.whatwg.org/multipage/scripting.html#the-canvas-element describe("htmlcanvaselement", () => { specify( "canvas element is an instance of HTMLElement and HTMLCanvasElement (GH-649)", () => { const { window } = new JSDOM(); const canvas = window.document.createElement("canvas"); assert.strictEqual(canvas instanceof window.HTMLElement, true); assert.strictEqual(canvas instanceof window.HTMLCanvasElement, true); } ); specify("canvas elements work with getElementById (GH-737)", () => { const { window } = new JSDOM(""); const canvas = window.document.getElementById("foo"); assert.ok(canvas); }); specify("canvas elements width and height must default to 300x150", () => { const { window } = new JSDOM(); const canvas = window.document.createElement("canvas"); assert.strictEqual(canvas.width, 300); assert.strictEqual(canvas.height, 150); canvas.width = 400; assert.strictEqual(canvas.width, 400); assert.strictEqual(canvas.getAttribute("width"), "400"); canvas.width = "blasdfhdf"; assert.strictEqual(canvas.width, 0); assert.strictEqual(canvas.getAttribute("width"), "0"); canvas.width = 500; assert.strictEqual(canvas.width, 500); assert.strictEqual(canvas.getAttribute("width"), "500"); canvas.width = -1; assert.strictEqual(canvas.width, 300); assert.strictEqual(canvas.getAttribute("width"), "300"); canvas.height = 400; assert.strictEqual(canvas.height, 400); assert.strictEqual(canvas.getAttribute("height"), "400"); canvas.height = "blasdfhdf"; assert.strictEqual(canvas.height, 0); assert.strictEqual(canvas.getAttribute("height"), "0"); canvas.height = 500; assert.strictEqual(canvas.height, 500); assert.strictEqual(canvas.getAttribute("height"), "500"); canvas.height = -1; assert.strictEqual(canvas.height, 150); assert.strictEqual(canvas.getAttribute("height"), "150"); }); specify( "canvas width and height must parse correctly initially (GH-1025)", () => { const { window } = new JSDOM(""); const canvas = window.document.querySelector("canvas"); assert.strictEqual(canvas.width, 99); assert.strictEqual(canvas.height, 101); } ); specify( "canvas must resize correctly when given a non-default width/height (GH-1025)", t => { if (!isCanvasInstalled(assert, t.done)) { return; } const { window } = new JSDOM(""); const canvas = window.document.querySelector("canvas"); const ctx = canvas.getContext("2d"); ctx.beginPath(); ctx.strokeStyle = "rgba(0,255,0,1)"; ctx.moveTo(50, 50); ctx.lineTo(50, 300); ctx.lineTo(300, 300); ctx.lineTo(300, 50); ctx.lineTo(50, 50); ctx.stroke(); ctx.closePath(); const fullPath = path.resolve(__dirname, "files/expected-canvas.png"); const expectedPNG = fs.readFileSync(fullPath); const expectedImg = PNG.sync.read(expectedPNG); const gotDataURL = parseDataURL(canvas.toDataURL()); const gotPNG = Buffer.from(gotDataURL.body); const gotImg = PNG.sync.read(gotPNG); assert.strictEqual(gotImg.width, expectedImg.width, "width"); assert.strictEqual(gotImg.height, expectedImg.height, "height"); assert.strictEqual(Buffer.compare(expectedImg.data, gotImg.data), 0, "byte-level comparison"); t.done(); }, { async: true } ); specify( "canvas width and height properties must reflect their attributes after setting them (GH-1281)", () => { const { window } = new JSDOM(""); const canvas = window.document.querySelector("canvas"); canvas.setAttribute("width", 99); canvas.setAttribute("height", 101); assert.strictEqual(canvas.width, 99); assert.strictEqual(canvas.height, 101); } ); specify( "toDataURL should work (when the canvas npm package is provided) (GH-1025)", t => { if (!isCanvasInstalled(assert, t.done)) { return; } const { window } = new JSDOM(""); const canvas = window.document.querySelector("canvas"); assert.strictEqual(canvas.toDataURL().substring(0, 22), "data:image/png;base64,"); t.done(); }, { async: true } ); specify( "loading an image and drawing it into the canvas should produce the expected result", t => { if (!isCanvasInstalled(assert, t.done)) { return; } const { window } = new JSDOM( "", { resources: "usable" } ); const canvas = window.document.querySelector("canvas"); const ctx = canvas.getContext("2d"); const image = new window.Image(); image.src = "file://" + path.resolve(__dirname, "files/image.png"); image.onload = () => { ctx.drawImage(image, 0, 0); const expected = fs.readFileSync(path.resolve(__dirname, "files/image.txt"), { encoding: "utf-8" }).trim(); assert.strictEqual(canvas.toDataURL(), expected); canvas.toBlob(blob => { assert.strictEqual(blob.type, "image/png"); assert.strictEqual(blob.size, 2614); t.done(); }, "image/png"); }; image.onerror = () => { assert.ok(false, "onerror should not be triggered when loading from valid URL"); t.done(); }; }, { async: true } ); }); jsdom-19.0.0/test/to-port-to-wpts/htmlelement.js000066400000000000000000000054331415223704400215760ustar00rootroot00000000000000"use strict"; const { assert } = require("chai"); const { describe, specify } = require("mocha-sugar-free"); const { JSDOM } = require("../.."); const nonInheritedTags = [ "article", "section", "nav", "aside", "hgroup", "header", "footer", "address", "dt", "dd", "figure", "figcaption", "main", "em", "strong", "small", "s", "cite", "abbr", "code", "i", "b", "u" ]; describe("htmlelement", () => { specify("unknown elements should return HTMLUnknownElement", () => { const doc = (new JSDOM()).window.document; const el = doc.createElement("foobar"); assert.ok( el.constructor === doc.defaultView.HTMLUnknownElement, "unknown element should inherit from HTMLUnknownElement (createElement)" ); assert.ok( el instanceof doc.defaultView.HTMLElement, "unknown element should inherit from HTMLElement too (createElement)" ); const doc2 = (new JSDOM("")).window.document; const el2 = doc2.body.firstChild; assert.ok( el2.constructor === doc2.defaultView.HTMLUnknownElement, "unknown element should inherit from HTMLUnknownElement (parsing)" ); assert.ok( el2 instanceof doc2.defaultView.HTMLElement, "unknown element should inherit from HTMLElement too (parsing)" ); }); specify("other elements should have their respective types", () => { const doc = (new JSDOM()).window.document; const el = doc.createElement("div"); assert.ok( el.constructor === doc.defaultView.HTMLDivElement, "div element should inherit from HTMLDivElement (createElement)" ); assert.ok( el instanceof doc.defaultView.HTMLElement, "div element should inherit from HTMLElement too (createElement)" ); const doc2 = (new JSDOM("
")).window.document; const el2 = doc2.body.firstChild; assert.ok( el2.constructor === doc2.defaultView.HTMLDivElement, "div element should inherit from HTMLDivElement (parsing)" ); assert.ok( el2 instanceof doc2.defaultView.HTMLElement, "div element should inherit from HTMLElement too (parsing)" ); }); specify("non-inherited elements should have the HTMLElement type", t => { t.timeout(5000); // give this a bit of leeway. It's apparently slow for (let i = 0; i < nonInheritedTags.length; ++i) { const doc = (new JSDOM("<" + nonInheritedTags[i] + ">")).window.document; const el = doc.body.firstChild; assert.ok( el.constructor === doc.defaultView.HTMLElement, nonInheritedTags[i] + " element should be a HTMLElement (parsing)" ); const el2 = doc.createElement(nonInheritedTags[i]); assert.ok( el2.constructor === doc.defaultView.HTMLElement, nonInheritedTags[i] + " element should be a HTMLElement (createElement)" ); } }); }); jsdom-19.0.0/test/to-port-to-wpts/htmlimageelement.js000066400000000000000000000122161415223704400225760ustar00rootroot00000000000000"use strict"; const fs = require("fs"); const path = require("path"); const http = require("http"); const { assert } = require("chai"); const { describe, specify } = require("mocha-sugar-free"); const { JSDOM } = require("../.."); const { isCanvasInstalled } = require("../util.js"); const toFileUrl = require("../util").toFileUrl(__dirname); describe("htmlimageelement", { skipIfBrowser: true }, () => { specify( "Image constructor should create a HTMLImageElement with specified width and height", () => { const { window } = new JSDOM(); const image = new window.Image(100, 200); assert.strictEqual(image.width, 100, "width should be set to the passed constructor parameter"); assert.strictEqual(image.height, 200, "height should be set to the passed constructor parameter"); } ); specify("loading image from valid external URL", t => { if (!isCanvasInstalled(assert, t.done)) { return; } const { window } = new JSDOM(``, { resources: "usable" }); const image = new window.Image(); const src = toFileUrl("files/image.png"); assert.strictEqual(image.width, 0, "before loading, width should be 0"); assert.strictEqual(image.height, 0, "before loading, height should be 0"); assert.strictEqual(image.naturalWidth, 0, "before loading, naturalWidth should be 0"); assert.strictEqual(image.naturalHeight, 0, "before loading, naturalHeight should be 0"); assert.strictEqual(image.complete, true, "before loading or setting src, complete should be true"); assert.strictEqual(image.src, "", "before loading, src should be an empty string"); assert.strictEqual(image.currentSrc, "", "before loading, currentSrc should be an empty string"); image.src = src; assert.strictEqual(image.complete, false, "before loading and after setting src, complete should be false"); image.onload = () => { assert.ok(true, "onload should be triggered when loading from valid URL."); assert.strictEqual(image.width, 168, "after loading, width should be 168"); assert.strictEqual(image.height, 168, "after loading, height should be 168"); assert.strictEqual(image.naturalWidth, 168, "after loading, naturalWidth should be 168"); assert.strictEqual(image.naturalHeight, 168, "after loading, naturalHeight should be 168"); assert.strictEqual(image.complete, true, "after loading, complete should be true"); assert.strictEqual(image.src, src, "after loading, src should be the image's URL"); assert.strictEqual(image.currentSrc, src, "after loading, currentSrc should be the image's URL"); t.done(); }; image.onerror = () => { assert.ok(false, "onerror should not be triggered when loading from valid URL"); t.done(); }; }, { async: true }); specify("loading images should work with relative URLs (GH-1536)", t => { if (!isCanvasInstalled(assert, t.done)) { return; } let requestsSoFar = 0; const server = http.createServer((request, response) => { if (requestsSoFar === 0) { assert.strictEqual(request.url, "/test.html"); response.end(``); } else { assert.strictEqual(request.url, "/test.jpg"); response.end(``); server.close(); t.done(); } ++requestsSoFar; }) .listen(); JSDOM.fromURL(`http://127.0.0.1:${server.address().port}/test.html`, { resources: "usable" }); }, { async: true }); specify("loading image from data URL", t => { if (!isCanvasInstalled(assert, t.done)) { return; } const { window } = new JSDOM(``, { resources: "usable" }); const image = new window.Image(); const src = fs.readFileSync(path.resolve(__dirname, "files/image.txt"), { encoding: "utf-8" }).trim(); image.onload = () => { assert.ok(true, "onload should be triggered when loading from data URL."); assert.strictEqual(image.width, 168, "after setting data URL, width should be 168"); assert.strictEqual(image.height, 168, "after setting data URL, height should be 168"); assert.strictEqual(image.complete, true, "after setting data URL, complete should be true"); assert.strictEqual(image.src, src, "after setting data URL, src should be the data URL"); assert.strictEqual(image.currentSrc, src, "after setting data URL, currentSrc should be the data URL"); t.done(); }; image.onerror = () => { assert.ok(false, "onerror should not be triggered when loading from valid URL"); t.done(); }; image.src = src; }, { async: true }); specify("loading image from invalid external URL", t => { if (!isCanvasInstalled(assert, t.done)) { return; } const { window } = new JSDOM(``, { resources: "usable" }); const image = new window.Image(); const src = "file://" + path.resolve(__dirname, "files/invalid.png"); image.onload = () => { assert.ok(false, "onload should not be triggered when loading from invalid URL."); t.done(); }; image.onerror = () => { assert.ok(true, "onerror should be triggered when loading from valid URL."); t.done(); }; image.src = src; }, { async: true }); }); jsdom-19.0.0/test/to-port-to-wpts/htmlinputelement.js000066400000000000000000000142161415223704400226550ustar00rootroot00000000000000"use strict"; const { assert } = require("chai"); const { describe, specify } = require("mocha-sugar-free"); const { JSDOM } = require("../.."); describe("htmlinputelement", () => { specify("html input should handle value/defaultValue correctly", () => { const input = (new JSDOM("")).window.document.querySelector("input"); assert.strictEqual(input.value, "", "value should equal empty string if uninitialized"); assert.strictEqual(input.defaultValue, "", "defaultValue should equal empty string if uninitialized"); assert.strictEqual(input.getAttribute("value"), null, "value attribute should be null (uninitialized)"); input.defaultValue = "abc"; assert.strictEqual( input.value, "abc", "setting the defaultValue should also change the value if \"dirty value\" is false" ); assert.strictEqual(input.defaultValue, "abc", "defaultValue should equal to set string"); assert.strictEqual(input.getAttribute("value"), "abc", "value attribute should equal to set string"); input.value = "def"; // dirtyValue is now true assert.strictEqual(input.value, "def", "value should get changed by setter"); assert.strictEqual(input.defaultValue, "abc", "defaultValue should equal to set string"); assert.strictEqual(input.getAttribute("value"), "abc", "value attribute should not change"); input.defaultValue = "abc2"; assert.strictEqual(input.value, "def", "value should not change by setting defaultValue is dirtyValue is set"); assert.strictEqual(input.defaultValue, "abc2", "defaultValue should equal to set string"); input.value = null; assert.strictEqual(input.value, "", "setting value to null should result in an empty string"); assert.strictEqual(input.getAttribute("value"), "abc2", "value attribute should not change"); }); specify("html input should handle checked/defaultChecked correctly", () => { const checked = (new JSDOM()).window.document.createElement("input"); assert.strictEqual(checked.checked, false, "checkedness is false by default"); checked.setAttribute("checked", "checked"); assert.strictEqual(checked.checked, true, "checked property must return the current checkedness"); checked.removeAttribute("checked"); assert.strictEqual( checked.checked, false, "dirty checkedness is still false, the checkedness should have been changed" ); checked.checked = false; // sets the element's dirty checkedness flag to true assert.strictEqual( checked.checked, false, "on setting, the checked property must set the element's checkedness to the new value" ); checked.setAttribute("checked", "checked"); assert.strictEqual( checked.checked, false, "checkedness should not have been changed because dirty checkedness is now true" ); }); specify("uncheck other radio buttons in the same group", () => { const doc = (new JSDOM()).window.document; const form = doc.createElement("form"); const div = doc.createElement("div"); const radioA = doc.createElement("input"); const radioB = doc.createElement("input"); const radioC = doc.createElement("input"); const checkD = doc.createElement("input"); radioA.type = "radio"; radioB.type = "radio"; radioC.type = "radio"; checkD.type = "checkbox"; radioA.name = "foo"; radioB.name = "foo"; radioC.name = "foo"; checkD.name = "foo"; div.appendChild(radioA); div.appendChild(radioB); // not yet C div.appendChild(checkD); checkD.checked = true; radioA.checked = true; radioB.checked = true; assert.strictEqual(radioA.checked, false, "Setting checked on a radio should uncheck others in the same group"); assert.strictEqual(radioB.checked, true, "Last radio to be set should be checked"); assert.strictEqual(checkD.checked, true, "Radio\"s should not affect the checkedness of checkboxes"); radioA.checked = true; form.appendChild(radioA); assert.strictEqual(radioA.checked, true, "Just checked this"); radioB.checked = true; form.appendChild(radioB); assert.strictEqual(radioB.checked, true, "Just checked this"); assert.strictEqual(radioA.checked, false, "Changing the form owner should uncheck others"); form.appendChild(radioC); radioC.name = "bar"; radioA.checked = true; radioC.checked = true; assert.strictEqual(radioA.checked, true, "Just checked this"); assert.strictEqual(radioC.checked, true, "Just checked this"); radioC.name = "foo"; assert.strictEqual(radioA.checked, false, "Changing the name should uncheck others"); assert.strictEqual(radioC.checked, true, "Changing the name not uncheck itself"); form.appendChild(checkD); radioC.checked = true; checkD.checked = true; assert.strictEqual(radioC.checked, true, "Just checked this"); checkD.type = "radio"; assert.strictEqual(radioC.checked, false, "Changing the type should uncheck others"); assert.strictEqual(checkD.checked, true, "Changing the name not uncheck itself"); }); specify( "inputs should default to type text on the property, despite having no attribute", () => { const doc = (new JSDOM(``)).window.document; const inputEl = doc.getElementById("input"); assert.equal(inputEl.hasAttribute("type"), false); assert.equal(inputEl.getAttribute("type"), null); assert.equal(inputEl.type, "text"); } ); specify("setting an input's type property should set its type attribute", () => { const doc = (new JSDOM(``)).window.document; const inputEl = doc.getElementById("input"); inputEl.type = "checkbox"; assert.equal(inputEl.getAttribute("type"), "checkbox"); }); specify( "an input's parsed type attribute should be reflected in both its property and attribute", () => { const doc = (new JSDOM(``)).window.document; const inputEl = doc.getElementById("input"); assert.equal(inputEl.type, "checkbox"); assert.equal(inputEl.getAttribute("type"), "checkbox"); } ); }); jsdom-19.0.0/test/to-port-to-wpts/inline-event-handlers.js000066400000000000000000000141421415223704400234500ustar00rootroot00000000000000"use strict"; const { assert } = require("chai"); const { describe, specify } = require("mocha-sugar-free"); const { JSDOM } = require("../.."); describe("inline-event-handlers", () => { specify("inline event handlers have the correct global scope", () => { const html = `
`; const doc = (new JSDOM(html, { runScripts: "dangerously" })).window.document; const div = doc.body.firstElementChild; div.click(); assert.equal(doc.foo, "clicked"); }); specify("inline error event handlers have the correct global scope", () => { const html = `
`; const doc = (new JSDOM(html, { runScripts: "dangerously" })).window.document; const e = new doc.defaultView.ErrorEvent("error"); doc.defaultView.dispatchEvent(e); assert.equal(doc.foo, "errored"); }); specify( "inline event handlers have their return values reflected in the corresponding property", () => { const doc = (new JSDOM(`
`, { runScripts: "dangerously" })).window.document; const div = doc.body.firstElementChild; assert.equal(div.onclick(), 10); } ); specify( "inline event handlers have their return values reflected in the corresponding property", () => { const doc = (new JSDOM(``, { runScripts: "dangerously" })).window.document; assert.equal(doc.defaultView.onerror(), 10); } ); specify("inline event handlers have access to an event argument", () => { const html = `
`; const doc = (new JSDOM(html, { runScripts: "dangerously" })).window.document; const div = doc.body.firstElementChild; div.click(); assert.equal(doc.bubbles, true); }); specify("inline error event handlers have access to a lot of arguments", () => { const html = ``; const doc = (new JSDOM(html, { runScripts: "dangerously" })).window.document; const errorObj = { should: "be this object" }; const e = new doc.defaultView.ErrorEvent("error", { message: "message blah", filename: "filenameblahblah", lineno: 5, colno: 10, error: errorObj }); doc.defaultView.dispatchEvent(e); assert.equal(doc.onerrorEvent, "message blah"); assert.equal(doc.onerrorSource, "filenameblahblah"); assert.equal(doc.onerrorLineno, 5); assert.equal(doc.onerrorColno, 10); assert.equal(doc.onerrorError, errorObj); }); specify( "inline event handlers set via properties have access to an event argument", t => { const doc = (new JSDOM(`
`)).window.document; const div = doc.body.firstElementChild; div.onclick = function (event) { assert.equal(event.constructor, doc.defaultView.MouseEvent); t.done(); }; div.click(); }, { async: true } ); specify( "inline error event handlers set via properties have access to lots of arguments", t => { const doc = (new JSDOM()).window.document; const errorObj = { should: "be this object" }; doc.defaultView.onerror = function (event, source, lineno, colno, error) { assert.equal(event, "message blah"); assert.equal(source, "filenameblahblah"); assert.equal(lineno, 5); assert.equal(colno, 10); assert.equal(error, errorObj); t.done(); }; const e = new doc.defaultView.ErrorEvent("error", { message: "message blah", filename: "filenameblahblah", lineno: 5, colno: 10, error: errorObj }); doc.defaultView.dispatchEvent(e); }, { async: true } ); const proxied = [ "onblur", "onerror", "onfocus", "onload", "onresize", "onscroll", "onafterprint", "onbeforeprint", "onbeforeunload", "onhashchange", "onlanguagechange", "onmessage", "onoffline", "ononline", "onpagehide", "onpageshow", "onpopstate", "onstorage", "onunload" ]; specify( "proxied body/window event handlers: setting on body as properties reflects on window", () => { const doc = (new JSDOM()).window.document; for (const name of proxied) { function handler() { // doesn't matter for this test } doc.body[name] = handler; assert.equal(doc.body[name], handler, `${name} should be set on the body correctly`); assert.equal(doc.defaultView[name], handler, `${name} should be set on the window correctly`); doc.body[name] = null; assert.equal(doc.body[name], null, `${name} should be unset on the body correctly`); assert.equal(doc.defaultView[name], null, `${name} should be unset on the window correctly`); } } ); specify( "proxied body/window event handlers: setting on body as attributes reflects on window", () => { const doc = (new JSDOM(``, { runScripts: "dangerously" })).window.document; for (const name of proxied) { doc.body.setAttribute(name, "return 5;"); assert.equal(doc.body[name](), 5, `${name} should be set on the body correctly`); assert.equal(doc.defaultView[name](), 5, `${name} should be set on the window correctly`); doc.body.removeAttribute(name); assert.equal(doc.body[name], null, `${name} should be unset on the body correctly`); assert.equal(doc.defaultView[name], null, `${name} should be unset on the window correctly`); } } ); specify( "proxied body/window event handlers: setting on body as attributes should not throw without a window", () => { const doc = (new JSDOM(``, { runScripts: "dangerously" })).window.document.implementation.createHTMLDocument(); for (const name of proxied) { doc.body.setAttribute(name, "return 5;"); assert.equal(doc.body[name], null, `${name} should be be null`); doc.body.removeAttribute(name); } } ); }); jsdom-19.0.0/test/to-port-to-wpts/inside-worker-smoke-tests.js000066400000000000000000000040201415223704400243050ustar00rootroot00000000000000"use strict"; const { assert } = require("chai"); const { describe, specify } = require("mocha-sugar-free"); const { JSDOM } = require("../.."); // These are tests specifically designed to showcase possible issues when run inside a worker (browserified), where we // can't run the full test suite. describe("jsdom/inside-worker-smoke-tests", () => { specify("execute scripts with global variables / window scope reference", () => { const { window } = new JSDOM(` `, { runScripts: "dangerously" }); assert.strictEqual(window.test, "true", "global variables should be on window"); assert.strictEqual(window.navigator.foo, "bar", "nested reference should work"); }); specify("execute scripts referring to global built-ins (GH-1175)", () => { const { window } = new JSDOM(``, { runScripts: "dangerously" }); assert.strictEqual(window.document.body.textContent, "ErrorObjectNaNtrue"); }); specify("test async global variable context", { async: true }, t => { const { window } = new JSDOM( ``, { runScripts: "dangerously" } ); assert.strictEqual(window.test, "true", "global variables should be on window"); setTimeout(() => { assert.strictEqual(window.test, "baz", "async write should be reflected"); t.done(); }, 1000); }); specify("clearTimeout (GH-1732)", { async: true }, t => { const { window } = new JSDOM(``, { runScripts: "dangerously" }); window.addEventListener("error", e => { assert.ifError(e.error); }); window.done = () => t.done(); }); }); jsdom-19.0.0/test/to-port-to-wpts/jsonp.js000066400000000000000000000023501415223704400204040ustar00rootroot00000000000000"use strict"; const { assert } = require("chai"); const { describe, specify } = require("mocha-sugar-free"); const { createServer } = require("../util.js"); const { JSDOM } = require("../.."); const { URL } = require("whatwg-url"); const path = require("path"); const jQueryFile = path.resolve(__dirname, "../jquery-fixtures/jquery-1.6.4.min.js"); describe("jsonp/jsonp", () => { specify("making a JSONP request from a jsdom window using jQuery", { skipIfBrowser: true }, () => { return createServer((req, res) => { const url = new URL("http://example.com" + req.url); res.writeHead(200); res.write(url.searchParams.get("jsoncallback") + `({"message":"jsonp works!"});`); res.end(); }).then(s => { const host = `http://127.0.0.1:${s.address().port}`; const options = { resources: "usable", runScripts: "dangerously" }; const { window } = new JSDOM(``, options); return new Promise(resolve => { window.onload = () => { window.jQuery.getJSON(host + "?jsoncallback=?", data => { assert.equal(data.message, "jsonp works!"); s.close(); resolve(); }); }; }); }); }); }); jsdom-19.0.0/test/to-port-to-wpts/level1/000077500000000000000000000000001415223704400201055ustar00rootroot00000000000000jsdom-19.0.0/test/to-port-to-wpts/level1/core.js000066400000000000000000014544131415223704400214070ustar00rootroot00000000000000"use strict"; const { assert } = require("chai"); const { describe, specify } = require("mocha-sugar-free"); const staff = require("./core/files/staff.xml"); const hc_staff = require("./core/files/hc_staff.xml"); const hc_nodtdstaff = require("./core/files/hc_nodtdstaff.xml"); const extra = require("./core/files/extra.xml"); const domTestHelper = require("../files/DOMTestCase"); // NB: these tests have been modified to be compliant with the modern DOM, instead of the "DOM Level 1" they were // written for. Check the revision history. describe("level1/core", () => { /** * Attr nodes may be associated with Element nodes contained within a DocumentFragment. Create a new DocumentFragment and add a newly created Element node(with one attribute). Once the element is added, its attribute should be available as an attribute associated with an Element within a DocumentFragment. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-35CB04B5 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68F082 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-B63ED1A3 */ specify("attrcreatedocumentfragment", () => { let success; let doc; let docFragment; let newOne; let domesticNode; let domesticAttr; let attrs; let attrName; let appendedChild; doc = staff.staff(); docFragment = doc.createDocumentFragment(); newOne = doc.createElement("newElement"); newOne.setAttribute("newdomestic", "Yes"); appendedChild = docFragment.appendChild(newOne); domesticNode = docFragment.firstChild; domesticAttr = domesticNode.attributes; attrs = domesticAttr.item(0); attrName = attrs.name; assert.equal(attrName, "newdomestic", "attrCreateDocumentFragmentAssert"); }); /** * The "setValue()" method for an attribute creates a Text node with the unparsed content of the string. Retrieve the attribute named "street" from the last child of of the fourth employee and assign the "Y&ent1;" string to its value attribute. This value is not yet parsed and therefore should still be the same upon retrieval. This test uses the "getNamedItem(name)" method from the NamedNodeMap interface. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-221662474 * @see http://lists.w3.org/Archives/Public/www-dom-ts/2002Apr/0057.html */ specify("attrcreatetextnode", () => { let success; let doc; let addressList; let testNode; let attributes; let streetAttr; let value; doc = staff.staff(); addressList = doc.getElementsByTagName("address"); testNode = addressList.item(3); attributes = testNode.attributes; streetAttr = attributes.getNamedItem("street"); streetAttr.value = "Y&ent1;"; value = streetAttr.value; assert.equal(value, "Y&ent1;", "value"); value = streetAttr.nodeValue; assert.equal(value, "Y&ent1;", "nodeValue"); }); /** * The "setNodeValue()" method for an attribute creates a Text node with the unparsed content of the string. Retrieve the attribute named "street" from the last child of of the fourth employee and assign the "Y&ent1;" string to its value attribute. This value is not yet parsed and therefore should still be the same upon retrieval. This test uses the "getNamedItem(name)" method from the NamedNodeMap interface. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D080 * @see http://lists.w3.org/Archives/Public/www-dom-ts/2002Apr/0057.html */ specify("attrcreatetextnode2", () => { let success; let doc; let addressList; let testNode; let attributes; let streetAttr; let value; doc = staff.staff(); addressList = doc.getElementsByTagName("address"); testNode = addressList.item(3); attributes = testNode.attributes; streetAttr = attributes.getNamedItem("street"); streetAttr.nodeValue = "Y&ent1;"; value = streetAttr.value; assert.equal(value, "Y&ent1;", "value"); value = streetAttr.nodeValue; assert.equal(value, "Y&ent1;", "nodeValue"); }); /** * If an Attr is explicitly assigned any value, then that value is the attributes effective value. Retrieve the attribute named "domestic" from the last child of of the first employee and examine its nodeValue attribute. This test uses the "getNamedItem(name)" method from the NamedNodeMap interface. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-84CF096 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1074577549 */ specify("attreffectivevalue", () => { let success; let doc; let addressList; let testNode; let attributes; let domesticAttr; let value; doc = staff.staff(); addressList = doc.getElementsByTagName("address"); testNode = addressList.item(0); attributes = testNode.attributes; domesticAttr = attributes.getNamedItem("domestic"); value = domesticAttr.nodeValue; assert.equal(value, "Yes", "attrEffectiveValueAssert"); }); /** * The getNodeName() method of an Attribute node. Retrieve the attribute named street from the last child of of the second employee and examine its NodeName. This test uses the getNamedItem(name) method from the NamedNodeMap interface. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D095 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1112119403 */ specify("attrname", () => { let success; let doc; let addressList; let testNode; let attributes; let streetAttr; let name; doc = staff.staff(); addressList = doc.getElementsByTagName("address"); testNode = addressList.item(1); attributes = testNode.attributes; streetAttr = attributes.getNamedItem("street"); name = streetAttr.name; assert.equal(name, "street", "nodeName"); name = streetAttr.name; assert.equal(name, "street", "name"); }); /** * The "getNextSibling()" method for an Attr node should return null. Retrieve the attribute named "domestic" from the last child of of the first employee and examine its NextSibling node. This test uses the "getNamedItem(name)" method from the NamedNodeMap interface. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-6AC54C2F * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-637646024 */ specify("attrnextsiblingnull", () => { let success; let doc; let addressList; let testNode; let attributes; let domesticAttr; let s; doc = staff.staff(); addressList = doc.getElementsByTagName("address"); testNode = addressList.item(0); attributes = testNode.attributes; domesticAttr = attributes.getNamedItem("domestic"); s = domesticAttr.nextSibling; assert.equal(s, null, "attrNextSiblingNullAssert"); }); /** * The "getParentNode()" method for an Attr node should return null. Retrieve the attribute named "domestic" from the last child of the first employee and examine its parentNode attribute. This test also uses the "getNamedItem(name)" method from the NamedNodeMap interface. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1060184317 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-637646024 */ specify("attrparentnodenull", () => { let success; let doc; let addressList; let testNode; let attributes; let domesticAttr; let s; doc = staff.staff(); addressList = doc.getElementsByTagName("address"); testNode = addressList.item(0); attributes = testNode.attributes; domesticAttr = attributes.getNamedItem("domestic"); s = domesticAttr.parentNode; assert.equal(s, null, "attrParentNodeNullAssert"); }); /** * The "getPreviousSibling()" method for an Attr node should return null. Retrieve the attribute named "domestic" from the last child of of the first employee and examine its PreviousSibling node. This test uses the "getNamedItem(name)" method from the NamedNodeMap interface. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-640FB3C8 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-637646024 */ specify("attrprevioussiblingnull", () => { let success; let doc; let addressList; let testNode; let attributes; let domesticAttr; let s; doc = staff.staff(); addressList = doc.getElementsByTagName("address"); testNode = addressList.item(0); attributes = testNode.attributes; domesticAttr = attributes.getNamedItem("domestic"); s = domesticAttr.previousSibling; assert.equal(s, null, "attrPreviousSiblingNullAssert"); }); /** * The "getSpecified()" method for an Attr node should be set to true if the attribute was explicitly given a value. Retrieve the attribute named "domestic" from the last child of of the first employee and examine the value returned by the "getSpecified()" method. This test uses the "getNamedItem(name)" method from the NamedNodeMap interface. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-862529273 */ specify("attrspecifiedvalue", () => { let success; let doc; let addressList; let testNode; let attributes; let domesticAttr; let state; doc = staff.staff(); addressList = doc.getElementsByTagName("address"); testNode = addressList.item(0); attributes = testNode.attributes; domesticAttr = attributes.getNamedItem("domestic"); state = domesticAttr.specified; assert.ok(state, "domesticSpecified"); }); /** * The "getSpecified()" method for an Attr node should return true if the value of the attribute is changed. Retrieve the attribute named "street" from the last child of of the THIRD employee and change its value to "Yes"(which is the default DTD value). This should cause the "getSpecified()" method to be true. This test uses the "setAttribute(name,value)" method from the Element interface and the "getNamedItem(name)" method from the NamedNodeMap interface. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-862529273 */ specify("attrspecifiedvaluechanged", () => { let success; let doc; let addressList; let testNode; let attributes; let streetAttr; let state; doc = staff.staff(); addressList = doc.getElementsByTagName("address"); testNode = addressList.item(2); testNode.setAttribute("street", "Yes"); attributes = testNode.attributes; streetAttr = attributes.getNamedItem("street"); state = streetAttr.specified; assert.ok(state, "streetSpecified"); }); /** * The "appendData(arg)" method appends a string to the end of the character data of the node. Retrieve the character data from the second child of the first employee. The appendData(arg) method is called with arg=", Esquire". The method should append the specified data to the already existing character data. The new value return by the "getLength()" method should be 24. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-32791A2F */ specify("characterdataappenddata", () => { let success; let doc; let elementList; let nameNode; let child; let childValue; let childLength; doc = staff.staff(); elementList = doc.getElementsByTagName("name"); nameNode = elementList.item(0); child = nameNode.firstChild; child.appendData(", Esquire"); childValue = child.data; childLength = childValue.length; assert.equal(childLength, 24, "characterdataAppendDataAssert"); }); /** * On successful invocation of the "appendData(arg)" method the "getData()" method provides access to the concatentation of data and the specified string. Retrieve the character data from the second child of the first employee. The appendData(arg) method is called with arg=", Esquire". The method should append the specified data to the already existing character data. The new value return by the "getData()" method should be "Margaret Martin, Esquire". * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-32791A2F */ specify("characterdataappenddatagetdata", () => { let success; let doc; let elementList; let nameNode; let child; let childData; doc = staff.staff(); elementList = doc.getElementsByTagName("name"); nameNode = elementList.item(0); child = nameNode.firstChild; child.appendData(", Esquire"); childData = child.data; assert.equal(childData, "Margaret Martin, Esquire", "characterdataAppendDataGetDataAssert"); }); /** * The "deleteData(offset,count)" method removes a range of characters from the node. Delete data at the beginning of the character data. Retrieve the character data from the last child of the first employee. The "deleteData(offset,count)" method is then called with offset=0 and count=16. The method should delete the characters from position 0 thru position 16. The new value of the character data should be "Dallas, Texas 98551". * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-7C603781 */ specify("characterdatadeletedatabegining", () => { let success; let doc; let elementList; let nameNode; let child; let childData; doc = staff.staff(); elementList = doc.getElementsByTagName("address"); nameNode = elementList.item(0); child = nameNode.firstChild; child.deleteData(0, 16); childData = child.data; assert.equal(childData, "Dallas, Texas 98551", "characterdataDeleteDataBeginingAssert"); }); /** * The "deleteData(offset,count)" method removes a range of characters from the node. Delete data at the end of the character data. Retrieve the character data from the last child of the first employee. The "deleteData(offset,count)" method is then called with offset=30 and count=5. The method should delete the characters from position 30 thru position 35. The new value of the character data should be "1230 North Ave. Dallas, Texas". * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-7C603781 */ specify("characterdatadeletedataend", () => { let success; let doc; let elementList; let nameNode; let child; let childData; doc = staff.staff(); elementList = doc.getElementsByTagName("address"); nameNode = elementList.item(0); child = nameNode.firstChild; child.deleteData(30, 5); childData = child.data; assert.equal(childData, "1230 North Ave. Dallas, Texas ", "characterdataDeleteDataEndAssert"); }); /** * If the sum of the offset and count used in the "deleteData(offset,count) method is greater than the length of the character data then all the characters from the offset to the end of the data are deleted. Retrieve the character data from the last child of the first employee. The "deleteData(offset,count)" method is then called with offset=4 and count=50. The method should delete the characters from position 4 to the end of the data since the offset+count(50+4) is greater than the length of the character data(35). The new value of the character data should be "1230". * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-7C603781 */ specify("characterdatadeletedataexceedslength", () => { let success; let doc; let elementList; let nameNode; let child; let childData; doc = staff.staff(); elementList = doc.getElementsByTagName("address"); nameNode = elementList.item(0); child = nameNode.firstChild; child.deleteData(4, 50); childData = child.data; assert.equal(childData, "1230", "characterdataDeleteDataExceedsLengthAssert"); }); /** * On successful invocation of the "deleteData(offset,count)" method, the "getData()" and "getLength()" methods reflect the changes. Retrieve the character data from the last child of the first employee. The "deleteData(offset,count)" method is then called with offset=30 and count=5. The method should delete the characters from position 30 thru position 35. The new value of the character data should be "1230 North Ave. Dallas, Texas" which is returned by the "getData()" method and "getLength()" method should return 30". * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-7D61178C * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-7C603781 */ specify("characterdatadeletedatagetlengthanddata", () => { let success; let doc; let elementList; let nameNode; let child; let childData; let childLength; let result = new Array(); doc = staff.staff(); elementList = doc.getElementsByTagName("address"); nameNode = elementList.item(0); child = nameNode.firstChild; child.deleteData(30, 5); childData = child.data; assert.equal(childData, "1230 North Ave. Dallas, Texas ", "data"); childLength = child.length; assert.equal(childLength, 30, "length"); }); /** * The "deleteData(offset,count)" method removes a range of characters from the node. Delete data in the middle of the character data. Retrieve the character data from the last child of the first employee. The "deleteData(offset,count)" method is then called with offset=16 and count=8. The method should delete the characters from position 16 thru position 24. The new value of the character data should be "1230 North Ave. Texas 98551". * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-7C603781 */ specify("characterdatadeletedatamiddle", () => { let success; let doc; let elementList; let nameNode; let child; let childData; doc = staff.staff(); elementList = doc.getElementsByTagName("address"); nameNode = elementList.item(0); child = nameNode.firstChild; child.deleteData(16, 8); childData = child.data; assert.equal(childData, "1230 North Ave. Texas 98551", "characterdataDeleteDataMiddleAssert"); }); /** * The "getData()" method retrieves the character data currently stored in the node. Retrieve the character data from the second child of the first employee and invoke the "getData()" method. The method returns the character data string. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359 */ specify("characterdatagetdata", () => { let success; let doc; let elementList; let nameNode; let child; let childData; doc = staff.staff(); elementList = doc.getElementsByTagName("name"); nameNode = elementList.item(0); child = nameNode.firstChild; childData = child.data; assert.equal(childData, "Margaret Martin", "characterdataGetDataAssert"); }); /** * The "getLength()" method returns the number of characters stored in this nodes data. Retrieve the character data from the second child of the first employee and examine the value returned by the getLength() method. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-7D61178C */ specify("characterdatagetlength", () => { let success; let doc; let elementList; let nameNode; let child; let childValue; let childLength; doc = staff.staff(); elementList = doc.getElementsByTagName("name"); nameNode = elementList.item(0); child = nameNode.firstChild; childValue = child.data; childLength = childValue.length; assert.equal(childLength, 15, "characterdataGetLengthAssert"); }); /** * The "deleteData(offset,count)" method works with negative counts. Retrieve the character data of the last child of the first employee and invoke its "deleteData(offset,count)" method with offset=10 and count=-3. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INDEX_SIZE_ERR']) * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-6531BCCF * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-6531BCCF')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INDEX_SIZE_ERR']) */ specify("characterdataindexsizeerrdeletedatacountnegative", () => { let success; let doc; let elementList; let nameNode; let child; doc = staff.staff(); elementList = doc.getElementsByTagName("address"); nameNode = elementList.item(0); child = nameNode.firstChild; child.deleteData(10, -3); assert.equal(child.data, "1230 North"); }); /** * The "deleteData(offset,count)" method raises an INDEX_SIZE_ERR DOMException if the specified offset is greater that the number of characters in the string. Retrieve the character data of the last child of the first employee and invoke its "deleteData(offset,count)" method with offset=40 and count=3. It should raise the desired exception since the offset is greater than the number of characters in the string. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INDEX_SIZE_ERR']) * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-7C603781 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-7C603781')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INDEX_SIZE_ERR']) * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-7C603781 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=249 */ specify("characterdataindexsizeerrdeletedataoffsetgreater", () => { let success; let doc; let elementList; let nameNode; let child; doc = staff.staff(); elementList = doc.getElementsByTagName("address"); nameNode = elementList.item(0); child = nameNode.firstChild; { success = false; try { child.deleteData(40, 3); } catch (ex) { success = (typeof (ex.code) !== "undefined" && ex.code === 1); } assert.ok(success, "throw_INDEX_SIZE_ERR"); } }); /** * The "deleteData(offset,count)" method raises an INDEX_SIZE_ERR DOMException if the specified offset is negative. Retrieve the character data of the last child of the first employee and invoke its "deleteData(offset,count)" method with offset=-5 and count=3. It should raise the desired exception since the offset is negative. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INDEX_SIZE_ERR']) * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-7C603781 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-7C603781')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INDEX_SIZE_ERR']) * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-7C603781 */ specify("characterdataindexsizeerrdeletedataoffsetnegative", () => { let success; let doc; let elementList; let nameNode; let child; doc = staff.staff(); elementList = doc.getElementsByTagName("address"); nameNode = elementList.item(0); child = nameNode.firstChild; { success = false; try { child.deleteData(-5, 3); } catch (ex) { success = (typeof (ex.code) !== "undefined" && ex.code === 1); } assert.ok(success, "throws_INDEX_SIZE_ERR"); } }); /** * The "insertData(offset,arg)" method raises an INDEX_SIZE_ERR DOMException if the specified offset is greater than the number of characters in the string. Retrieve the character data of the last child of the first employee and invoke its insertData"(offset,arg)" method with offset=40 and arg="ABC". It should raise the desired exception since the offset is greater than the number of characters in the string. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INDEX_SIZE_ERR']) * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-7C603781 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-7C603781')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INDEX_SIZE_ERR']) * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=249 */ specify("characterdataindexsizeerrinsertdataoffsetgreater", () => { let success; let doc; let elementList; let nameNode; let child; doc = staff.staff(); elementList = doc.getElementsByTagName("address"); nameNode = elementList.item(0); child = nameNode.firstChild; { success = false; try { child.insertData(40, "ABC"); } catch (ex) { success = (typeof (ex.code) !== "undefined" && ex.code === 1); } assert.ok(success, "throw_INDEX_SIZE_ERR"); } }); /** * The "insertData(offset,arg)" method raises an INDEX_SIZE_ERR DOMException if the specified offset is negative. Retrieve the character data of the last child of the first employee and invoke its insertData"(offset,arg)" method with offset=-5 and arg="ABC". It should raise the desired exception since the offset is negative. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INDEX_SIZE_ERR']) * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-E5CBA7FB * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-E5CBA7FB')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INDEX_SIZE_ERR']) */ specify("characterdataindexsizeerrinsertdataoffsetnegative", () => { let success; let doc; let elementList; let nameNode; let child; doc = staff.staff(); elementList = doc.getElementsByTagName("address"); nameNode = elementList.item(0); child = nameNode.firstChild; { success = false; try { child.insertData(-5, "ABC"); } catch (ex) { success = (typeof (ex.code) !== "undefined" && ex.code === 1); } assert.ok(success, "throws_INDEX_SIZE_ERR"); } }); /** * The "replaceData(offset,count,arg)" method works with negative counts. Retrieve the character data of the last child of the first employee and invoke its "replaceData(offset,count,arg) method with offset=10 and count=-3 and arg="ABC". * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INDEX_SIZE_ERR']) * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-6531BCCF * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-6531BCCF')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INDEX_SIZE_ERR']) */ specify("characterdataindexsizeerrreplacedatacountnegative", () => { let success; let doc; let elementList; let nameNode; let child; doc = staff.staff(); elementList = doc.getElementsByTagName("address"); nameNode = elementList.item(0); child = nameNode.firstChild; child.replaceData(10, -3, "ABC"); assert.equal(child.data, "1230 NorthABC"); }); /** * The "replaceData(offset,count,arg)" method raises an INDEX_SIZE_ERR DOMException if the specified offset is greater than the length of the string. Retrieve the character data of the last child of the first employee and invoke its "replaceData(offset,count,arg) method with offset=40 and count=3 and arg="ABC". It should raise the desired exception since the offset is greater than the length of the string. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INDEX_SIZE_ERR']) * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-7C603781 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-7C603781')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INDEX_SIZE_ERR']) * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=249 */ specify("characterdataindexsizeerrreplacedataoffsetgreater", () => { let success; let doc; let elementList; let nameNode; let child; doc = staff.staff(); elementList = doc.getElementsByTagName("address"); nameNode = elementList.item(0); child = nameNode.firstChild; { success = false; try { child.replaceData(40, 3, "ABC"); } catch (ex) { success = (typeof (ex.code) !== "undefined" && ex.code === 1); } assert.ok(success, "throw_INDEX_SIZE_ERR"); } }); /** * The "replaceData(offset,count,arg)" method raises an INDEX_SIZE_ERR DOMException if the specified offset is negative. Retrieve the character data of the last child of the first employee and invoke its "replaceData(offset,count,arg) method with offset=-5 and count=3 and arg="ABC". It should raise the desired exception since the offset is negative. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INDEX_SIZE_ERR']) * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-E5CBA7FB * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-E5CBA7FB')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INDEX_SIZE_ERR']) * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-E5CBA7FB */ specify("characterdataindexsizeerrreplacedataoffsetnegative", () => { let success; let doc; let elementList; let nameNode; let child; doc = staff.staff(); elementList = doc.getElementsByTagName("address"); nameNode = elementList.item(0); child = nameNode.firstChild; { success = false; try { child.replaceData(-5, 3, "ABC"); } catch (ex) { success = (typeof (ex.code) !== "undefined" && ex.code === 1); } assert.ok(success, "throws_INDEX_SIZE_ERR"); } }); /** * The "substringData(offset,count)" method works if count is negative. Retrieve the character data of the last child of the first employee and invoke its "substringData(offset,count) method with offset=10 and count=-3. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INDEX_SIZE_ERR']) * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-6531BCCF * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-6531BCCF')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INDEX_SIZE_ERR']) */ specify("characterdataindexsizeerrsubstringcountnegative", () => { let success; let doc; let elementList; let nameNode; let child; let badSubstring; doc = staff.staff(); elementList = doc.getElementsByTagName("address"); nameNode = elementList.item(0); child = nameNode.firstChild; badSubstring = child.substringData(10, -3); assert.equal(badSubstring, " Ave. Dallas, Texas 98551"); }); /** * The "substringData(offset,count)" method raises an INDEX_SIZE_ERR DOMException if the specified offset is negative. Retrieve the character data of the last child of the first employee and invoke its "substringData(offset,count) method with offset=-5 and count=3. It should raise the desired exception since the offset is negative. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INDEX_SIZE_ERR']) * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-6531BCCF * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-6531BCCF')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INDEX_SIZE_ERR']) */ specify("characterdataindexsizeerrsubstringnegativeoffset", () => { let success; let doc; let elementList; let nameNode; let child; let badString; doc = staff.staff(); elementList = doc.getElementsByTagName("address"); nameNode = elementList.item(0); child = nameNode.firstChild; { success = false; try { badString = child.substringData(-5, 3); } catch (ex) { success = (typeof (ex.code) !== "undefined" && ex.code === 1); } assert.ok(success, "throws_INDEX_SIZE_ERR"); } }); /** * The "substringData(offset,count)" method raises an INDEX_SIZE_ERR DOMException if the specified offset is greater than the number of characters in the string. Retrieve the character data of the last child of the first employee and invoke its "substringData(offset,count) method with offset=40 and count=3. It should raise the desired exception since the offsets value is greater than the length. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INDEX_SIZE_ERR']) * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-6531BCCF * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-6531BCCF')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INDEX_SIZE_ERR']) * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=249 */ specify("characterdataindexsizeerrsubstringoffsetgreater", () => { let success; let doc; let elementList; let nameNode; let child; let badString; doc = staff.staff(); elementList = doc.getElementsByTagName("address"); nameNode = elementList.item(0); child = nameNode.firstChild; { success = false; try { badString = child.substringData(40, 3); } catch (ex) { success = (typeof (ex.code) !== "undefined" && ex.code === 1); } assert.ok(success, "throw_INDEX_SIZE_ERR"); } }); /** * The "insertData(offset,arg)" method will insert a string at the specified character offset. Insert the data at the beginning of the character data. Retrieve the character data from the second child of the first employee. The "insertData(offset,arg)" method is then called with offset=0 and arg="Mss.". The method should insert the string "Mss." at position 0. The new value of the character data should be "Mss. Margaret Martin". * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-3EDB695F */ specify("characterdatainsertdatabeginning", () => { let success; let doc; let elementList; let nameNode; let child; let childData; doc = staff.staff(); elementList = doc.getElementsByTagName("name"); nameNode = elementList.item(0); child = nameNode.firstChild; child.insertData(0, "Mss. "); childData = child.data; assert.equal(childData, "Mss. Margaret Martin", "characterdataInsertDataBeginningAssert"); }); /** * The "insertData(offset,arg)" method will insert a string at the specified character offset. Insert the data at the end of the character data. Retrieve the character data from the second child of the first employee. The "insertData(offset,arg)" method is then called with offset=15 and arg=", Esquire". The method should insert the string ", Esquire" at position 15. The new value of the character data should be "Margaret Martin, Esquire". * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-3EDB695F */ specify("characterdatainsertdataend", () => { let success; let doc; let elementList; let nameNode; let child; let childData; doc = staff.staff(); elementList = doc.getElementsByTagName("name"); nameNode = elementList.item(0); child = nameNode.firstChild; child.insertData(15, ", Esquire"); childData = child.data; assert.equal(childData, "Margaret Martin, Esquire", "characterdataInsertDataEndAssert"); }); /** * The "insertData(offset,arg)" method will insert a string at the specified character offset. Insert the data in the middle of the character data. Retrieve the character data from the second child of the first employee. The "insertData(offset,arg)" method is then called with offset=9 and arg="Ann". The method should insert the string "Ann" at position 9. The new value of the character data should be "Margaret Ann Martin". * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-3EDB695F */ specify("characterdatainsertdatamiddle", () => { let success; let doc; let elementList; let nameNode; let child; let childData; doc = staff.staff(); elementList = doc.getElementsByTagName("name"); nameNode = elementList.item(0); child = nameNode.firstChild; child.insertData(9, "Ann "); childData = child.data; assert.equal(childData, "Margaret Ann Martin", "characterdataInsertDataMiddleAssert"); }); /** * The "replaceData(offset,count,arg)" method replaces the characters starting at the specified offset with the specified string. Test for replacement in the middle of the data. Retrieve the character data from the last child of the first employee. The "replaceData(offset,count,arg)" method is then called with offset=5 and count=5 and arg="South". The method should replace characters five thru 9 of the character data with "South". * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-E5CBA7FB */ specify("characterdatareplacedatabegining", () => { let success; let doc; let elementList; let nameNode; let child; let childData; doc = staff.staff(); elementList = doc.getElementsByTagName("address"); nameNode = elementList.item(0); child = nameNode.firstChild; child.replaceData(0, 4, "2500"); childData = child.data; assert.equal(childData, "2500 North Ave. Dallas, Texas 98551", "characterdataReplaceDataBeginingAssert"); }); /** * The "replaceData(offset,count,arg)" method replaces the characters starting at the specified offset with the specified string. Test for replacement at the end of the data. Retrieve the character data from the last child of the first employee. The "replaceData(offset,count,arg)" method is then called with offset=30 and count=5 and arg="98665". The method should replace characters 30 thru 34 of the character data with "98665". * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-E5CBA7FB */ specify("characterdatareplacedataend", () => { let success; let doc; let elementList; let nameNode; let child; let childData; doc = staff.staff(); elementList = doc.getElementsByTagName("address"); nameNode = elementList.item(0); child = nameNode.firstChild; child.replaceData(30, 5, "98665"); childData = child.data; assert.equal(childData, "1230 North Ave. Dallas, Texas 98665", "characterdataReplaceDataEndAssert"); }); /** * The "replaceData(offset,count,arg)" method replaces the characters starting at the specified offset with the specified string. Test the situation where the length of the arg string is greater than the specified offset. Retrieve the character data from the last child of the first employee. The "replaceData(offset,count,arg)" method is then called with offset=0 and count=4 and arg="260030". The method should replace characters one thru four with "260030". Note that the length of the specified string is greater that the specified offset. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-E5CBA7FB */ specify("characterdatareplacedataexceedslengthofarg", () => { let success; let doc; let elementList; let nameNode; let child; let childData; doc = staff.staff(); elementList = doc.getElementsByTagName("address"); nameNode = elementList.item(0); child = nameNode.firstChild; child.replaceData(0, 4, "260030"); childData = child.data; assert.equal( childData, "260030 North Ave. Dallas, Texas 98551", "characterdataReplaceDataExceedsLengthOfArgAssert" ); }); /** * If the sum of the offset and count exceeds the length then all the characters to the end of the data are replaced. Retrieve the character data from the last child of the first employee. The "replaceData(offset,count,arg)" method is then called with offset=0 and count=50 and arg="2600". The method should replace all the characters with "2600". This is because the sum of the offset and count exceeds the length of the character data. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-E5CBA7FB */ specify("characterdatareplacedataexceedslengthofdata", () => { let success; let doc; let elementList; let nameNode; let child; let childData; doc = staff.staff(); elementList = doc.getElementsByTagName("address"); nameNode = elementList.item(0); child = nameNode.firstChild; child.replaceData(0, 50, "2600"); childData = child.data; assert.equal(childData, "2600", "characterdataReplaceDataExceedsLengthOfDataAssert"); }); /** * The "replaceData(offset,count,arg)" method replaces the characters starting at the specified offset with the specified string. Test for replacement in the middle of the data. Retrieve the character data from the last child of the first employee. The "replaceData(offset,count,arg)" method is then called with offset=5 and count=5 and arg="South". The method should replace characters five thru 9 of the character data with "South". * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-E5CBA7FB */ specify("characterdatareplacedatamiddle", () => { let success; let doc; let elementList; let nameNode; let child; let childData; doc = staff.staff(); elementList = doc.getElementsByTagName("address"); nameNode = elementList.item(0); child = nameNode.firstChild; child.replaceData(5, 5, "South"); childData = child.data; assert.equal(childData, "1230 South Ave. Dallas, Texas 98551", "characterdataReplaceDataMiddleAssert"); }); /** * The "setNodeValue()" method changes the character data currently stored in the node. Retrieve the character data from the second child of the first employee and invoke the "setNodeValue()" method, call "getData()" and compare. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359 */ specify("characterdatasetnodevalue", () => { let success; let doc; let elementList; let nameNode; let child; let childData; let childValue; doc = staff.staff(); elementList = doc.getElementsByTagName("name"); nameNode = elementList.item(0); child = nameNode.firstChild; child.nodeValue = "Marilyn Martin"; childData = child.data; assert.equal(childData, "Marilyn Martin", "data"); childValue = child.nodeValue; assert.equal(childValue, "Marilyn Martin", "value"); }); /** * If the sum of the "offset" and "count" exceeds the "length" then the "substringData(offset,count)" method returns all the characters to the end of the data. Retrieve the character data from the second child of the first employee and access part of the data by using the substringData(offset,count) method with offset=9 and count=10. The method should return the substring "Martin" since offset+count > length (19 > 15). * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-6531BCCF */ specify("characterdatasubstringexceedsvalue", () => { let success; let doc; let elementList; let nameNode; let child; let substring; doc = staff.staff(); elementList = doc.getElementsByTagName("name"); nameNode = elementList.item(0); child = nameNode.firstChild; substring = child.substringData(9, 10); assert.equal(substring, "Martin", "characterdataSubStringExceedsValueAssert"); }); /** * The "substringData(offset,count)" method returns the specified string. Retrieve the character data from the second child of the first employee and access part of the data by using the substringData(offset,count) method. The method should return the specified substring starting at position "offset" and extract "count" characters. The method should return the string "Margaret". * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-6531BCCF */ specify("characterdatasubstringvalue", () => { let success; let doc; let elementList; let nameNode; let child; let substring; doc = staff.staff(); elementList = doc.getElementsByTagName("name"); nameNode = elementList.item(0); child = nameNode.firstChild; substring = child.substringData(0, 8); assert.equal(substring, "Margaret", "characterdataSubStringValueAssert"); }); /** * A comment is all the characters between the starting '' Retrieve the nodes of the DOM document. Search for a comment node and the content is its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1334481328 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D095 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D080 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-111237558 */ specify("commentgetcomment", () => { let success; let doc; let elementList; let child; let childName; let childValue; let commentCount = 0; let childType; doc = staff.staff(); elementList = doc.childNodes; for (let indexN10057 = 0; indexN10057 < elementList.length; indexN10057++) { child = elementList.item(indexN10057); childType = child.nodeType; if ( (childType === 8) ) { childName = child.nodeName; assert.equal(childName, "#comment", "nodeName"); childValue = child.nodeValue; assert.equal(childValue, " This is comment number 1.", "nodeValue"); commentCount = commentCount + 1; } } assert.equal(commentCount, 1, "commentCount"); }); /** * The "createAttribute(name)" method creates an Attribute node of the given name. Retrieve the entire DOM document and invoke its "createAttribute(name)" method. It should create a new Attribute node with the given name. The name, value and type of the newly created object are retrieved and output. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1084891198 */ specify("documentcreateattribute", () => { let success; let doc; let newAttrNode; let attrValue; let attrName; doc = staff.staff(); newAttrNode = doc.createAttribute("district"); attrValue = newAttrNode.nodeValue; assert.equal(attrValue, "", "value"); attrName = newAttrNode.name; assert.equal(attrName, "district", "name"); }); /** * The "createComment(data)" method creates a new Comment node given the specified string. Retrieve the entire DOM document and invoke its "createComment(data)" method. It should create a new Comment node whose "data" is the specified string. The content, name and type are retrieved and output. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1334481328 */ specify("documentcreatecomment", () => { let success; let doc; let newCommentNode; let newCommentValue; let newCommentName; let newCommentType; doc = staff.staff(); newCommentNode = doc.createComment("This is a new Comment node"); newCommentValue = newCommentNode.nodeValue; assert.equal(newCommentValue, "This is a new Comment node", "value"); newCommentName = newCommentNode.nodeName; assert.equal(newCommentName, "#comment", "name"); newCommentType = newCommentNode.nodeType; assert.equal(newCommentType, 8, "type"); }); /** * The "createDocumentFragment()" method creates an empty DocumentFragment object. Retrieve the entire DOM document and invoke its "createDocumentFragment()" method. The content, name, type and value of the newly created object are output. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-35CB04B5 */ specify("documentcreatedocumentfragment", () => { let success; let doc; let newDocFragment; let children; let length; let newDocFragmentName; let newDocFragmentType; let newDocFragmentValue; doc = staff.staff(); newDocFragment = doc.createDocumentFragment(); children = newDocFragment.childNodes; length = children.length; assert.equal(length, 0, "length"); newDocFragmentName = newDocFragment.nodeName; assert.equal(newDocFragmentName, "#document-fragment", "name"); newDocFragmentType = newDocFragment.nodeType; assert.equal(newDocFragmentType, 11, "type"); newDocFragmentValue = newDocFragment.nodeValue; assert.equal(newDocFragmentValue, null, "value"); }); /** * The "createElement(tagName)" method creates an Element of the type specified. Retrieve the entire DOM document and invoke its "createElement(tagName)" method with tagName="address". The method should create an instance of an Element node whose tagName is "address". The NodeName, NodeType and NodeValue are returned. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-2141741547 */ specify("documentcreateelement", () => { let success; let doc; let newElement; let newElementName; let newElementType; let newElementValue; doc = staff.staff(); newElement = doc.createElement("address"); newElementName = newElement.nodeName; assert.equal(newElementName, "address", "name"); newElementType = newElement.nodeType; assert.equal(newElementType, 1, "type"); newElementValue = newElement.nodeValue; assert.equal(newElementValue, null, "valueInitiallyNull"); }); /** * The tagName parameter in the "createElement(tagName)" method is case-sensitive for XML documents. Retrieve the entire DOM document and invoke its "createElement(tagName)" method twice. Once for tagName equal to "address" and once for tagName equal to "ADDRESS" Each call should create a distinct Element node. The newly created Elements are then assigned attributes that are retrieved. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-2141741547 */ specify("documentcreateelementcasesensitive", () => { let success; let doc; let newElement1; let newElement2; let attribute1; let attribute2; doc = staff.staff(); newElement1 = doc.createElement("ADDRESS"); newElement2 = doc.createElement("address"); newElement1.setAttribute("district", "Fort Worth"); newElement2.setAttribute("county", "Dallas"); attribute1 = newElement1.getAttribute("district"); attribute2 = newElement2.getAttribute("county"); assert.equal(attribute1, "Fort Worth", "attrib1"); assert.equal(attribute2, "Dallas", "attrib2"); }); /** * The "createProcessingInstruction(target,data)" method creates a new ProcessingInstruction node with the specified name and data string. Retrieve the entire DOM document and invoke its "createProcessingInstruction(target,data)" method. It should create a new PI node with the specified target and data. The target, data and type are retrieved and output. * @author NIST * @author Mary Brady * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core# * @see http://lists.w3.org/Archives/Public/www-dom-ts/2001Apr/0020.html * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-135944439 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=249 */ specify("documentcreateprocessinginstruction", () => { let success; let doc; let newPINode; let piValue; let piName; let piType; doc = staff.staff(); newPINode = doc.createProcessingInstruction("TESTPI", "This is a new PI node"); assert.notEqual(newPINode, null, "createdPINotNull"); piName = newPINode.nodeName; assert.equal(piName, "TESTPI", "name"); piValue = newPINode.nodeValue; assert.equal(piValue, "This is a new PI node", "value"); piType = newPINode.nodeType; assert.equal(piType, 7, "type"); }); /** * The "createTextNode(data)" method creates a Text node given the specfied string. Retrieve the entire DOM document and invoke its "createTextNode(data)" method. It should create a new Text node whose "data" is the specified string. The NodeName and NodeType are also checked. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1975348127 */ specify("documentcreatetextnode", () => { let success; let doc; let newTextNode; let newTextName; let newTextValue; let newTextType; doc = staff.staff(); newTextNode = doc.createTextNode("This is a new Text node"); newTextValue = newTextNode.nodeValue; assert.equal(newTextValue, "This is a new Text node", "value"); newTextName = newTextNode.nodeName; assert.equal(newTextName, "#text", "name"); newTextType = newTextNode.nodeType; assert.equal(newTextType, 3, "type"); }); /** * The "getDoctype()" method returns the Document Type Declaration associated with this document. Retrieve the entire DOM document and invoke its "getDoctype()" method. The name of the document type should be returned. The "getName()" method should be equal to "staff" or "svg". * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-B63ED1A31 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D080 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=249 */ specify("documentgetdoctype", () => { let success; let doc; let docType; let docTypeName; let nodeValue; doc = staff.staff(); docType = doc.doctype; assert.notEqual(docType, null, "docTypeNotNull"); docTypeName = docType.name; assert.equal(docTypeName, "staff", "doctypeName"); nodeValue = docType.nodeValue; assert.equal(nodeValue, null, "initiallyNull"); assert.equal(docType.systemId, "staff.dtd"); }); /** * The "getDoctype()" method returns null for XML documents without a document type declaration. Retrieve the XML document without a DTD and invoke the "getDoctype()" method. It should return null. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-B63ED1A31 */ specify("documentgetdoctypenodtd", () => { let success; let doc; let docType; doc = hc_nodtdstaff.hc_nodtdstaff(); docType = doc.doctype; assert.equal(docType, null, "documentGetDocTypeNoDTDAssert"); }); /** * The "getElementsByTagName(tagName)" method returns a NodeList of all the Elements with a given tagName. Retrieve the entire DOM document and invoke its "getElementsByTagName(tagName)" method with tagName equal to "name". The method should return a NodeList that contains 5 elements. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-A6C9094 */ specify("documentgetelementsbytagnamelength", () => { let success; let doc; let nameList; doc = staff.staff(); nameList = doc.getElementsByTagName("name"); assert.equal(nameList.length, 5, "documentGetElementsByTagNameLengthAssert"); }); /** * Retrieve the entire DOM document, invoke getElementsByTagName("*") and check the length of the NodeList. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-A6C9094 */ specify("documentgetelementsbytagnametotallength", () => { let success; let doc; let nameList; doc = staff.staff(); nameList = doc.getElementsByTagName("*"); // NB: 37 if entity expansion is supported (jsdom does not) assert.equal(nameList.length, 36, "documentGetElementsByTagNameTotalLengthAssert"); }); /** * The "getElementsByTagName(tagName)" method returns a NodeList of all the Elements with a given tagName in a pre-order traversal of the tree. Retrieve the entire DOM document and invoke its "getElementsByTagName(tagName)" method with tagName equal to "name". The method should return a NodeList that contains 5 elements. The FOURTH item in the list is retrieved and output. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-A6C9094 */ specify("documentgetelementsbytagnamevalue", () => { let success; let doc; let nameList; let nameNode; let firstChild; let childValue; doc = staff.staff(); nameList = doc.getElementsByTagName("name"); nameNode = nameList.item(3); firstChild = nameNode.firstChild; childValue = firstChild.nodeValue; assert.equal(childValue, "Jeny Oconnor", "documentGetElementsByTagNameValueAssert"); }); /** * The "getImplementation()" method returns the DOMImplementation object that handles this document. Retrieve the entire DOM document and invoke its "getImplementation()" method. It should return a DOMImplementation whose "hasFeature("XML","1.0") method returns the boolean value "true". * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1B793EBA */ specify("documentgetimplementation", () => { let success; let doc; let docImpl; let state; doc = staff.staff(); docImpl = doc.implementation; state = docImpl.hasFeature("XML", "1.0"); assert.ok(state, "documentGetImplementationAssert"); }); /** * The "getDocumentElement()" method provides direct access to the child node that is the root element of the document. Retrieve the entire DOM document and invoke its "getDocumentElement()" method. It should return an Element node whose NodeName is "staff" (or "svg"). * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-87CD092 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=251 */ specify("documentgetrootnode", () => { let success; let doc; let root; let rootName; doc = staff.staff(); root = doc.documentElement; rootName = root.nodeName; assert.equal(rootName, "staff", "documentGetRootNodeAssert"); }); /** * The "createAttribute(tagName)" method raises an INVALID_CHARACTER_ERR DOMException if the specified tagName contains an invalid character. Retrieve the entire DOM document and invoke its "createAttribute(tagName)" method with the tagName equal to the string "invalid^Name". Due to the invalid character the desired EXCEPTION should be raised. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INVALID_CHARACTER_ERR']) * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1084891198 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-1084891198')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INVALID_CHARACTER_ERR']) * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1084891198 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=249 */ specify("documentinvalidcharacterexceptioncreateattribute", () => { let success; let doc; let createdAttr; doc = staff.staff(); { success = false; try { createdAttr = doc.createAttribute("invalid'Name"); } catch (ex) { success = (typeof (ex.code) !== "undefined" && ex.code === 5); } assert.ok(success, "throw_INVALID_CHARACTER_ERR"); } }); /** * The "createElement(tagName)" method raises an INVALID_CHARACTER_ERR DOMException if the specified tagName contains an invalid character. Retrieve the entire DOM document and invoke its "createElement(tagName)" method with the tagName equal to the string "invalid^Name". Due to the invalid character the desired EXCEPTION should be raised. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INVALID_CHARACTER_ERR']) * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-2141741547 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-2141741547')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INVALID_CHARACTER_ERR']) * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-2141741547 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=249 */ specify("documentinvalidcharacterexceptioncreateelement", () => { let success; let doc; let badElement; doc = staff.staff(); { success = false; try { badElement = doc.createElement("invalid^Name"); } catch (ex) { success = (typeof (ex.code) !== "undefined" && ex.code === 5); } assert.ok(success, "throw_INVALID_CHARACTER_ERR"); } }); /** * The "createProcessingInstruction(target,data) method raises an INVALID_CHARACTER_ERR DOMException if the specified tagName contains an invalid character. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INVALID_CHARACTER_ERR']) * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-135944439 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-135944439')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INVALID_CHARACTER_ERR']) * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=249 */ specify("documentinvalidcharacterexceptioncreatepi", () => { let success; let doc; let badPI; doc = hc_staff.hc_staff(); success = false; try { badPI = doc.createProcessingInstruction("invalid^Name", "data"); } catch (ex) { success = (typeof (ex.code) !== "undefined" && ex.code === 5); } assert.ok(success, "throw_INVALID_CHARACTER_ERR"); }); /** * Creating a processing instruction with an empty target should cause an INVALID_CHARACTER_ERR. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INVALID_CHARACTER_ERR']) * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-135944439 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-135944439')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INVALID_CHARACTER_ERR']) * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=525 */ specify("documentinvalidcharacterexceptioncreatepi1", () => { let success; let doc; let badPI; doc = hc_staff.hc_staff(); success = false; try { badPI = doc.createProcessingInstruction("", "data"); } catch (ex) { success = (typeof (ex.code) !== "undefined" && ex.code === 5); } assert.ok(success, "throw_INVALID_CHARACTER_ERR"); }); /** * The "getName()" method contains the name of the DTD. Retrieve the Document Type for this document and examine the string returned by the "getName()" method. It should be set to "staff". * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-B63ED1A31 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1844763134 */ specify("documenttypegetdoctype", () => { let success; let doc; let docType; let name; doc = staff.staff(); docType = doc.doctype; assert.notEqual(docType, null, "docTypeNotNull"); name = docType.name; assert.equal(name, "staff", "documenttypeGetDocTypeAssert"); }); /** * hasFeature("XML", "") should return true for implementations that can read staff files. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-5CED94D7 * @see http://www.w3.org/2000/11/DOM-Level-2-errata#core-14 */ specify("domimplementationfeaturenoversion", () => { let success; let doc; let domImpl; let state; doc = staff.staff(); domImpl = doc.implementation; state = domImpl.hasFeature("XML", ""); assert.ok(state, "hasXMLEmpty"); }); /** * hasFeature("XML", null) should return true for implementations that can read staff documents. * @author NIST * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-5CED94D7 * @see http://www.w3.org/2000/11/DOM-Level-2-errata#core-14 */ specify("domimplementationfeaturenull", () => { let success; let doc; let domImpl; let state; let nullVersion = null; doc = staff.staff(); domImpl = doc.implementation; state = domImpl.hasFeature("XML", nullVersion); assert.ok(state, "hasXMLnull"); }); /** * hasFeature("xml", "1.0") should return true for implementations that can read staff documents. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-5CED94D7 */ specify("domimplementationfeaturexml", () => { let success; let doc; let domImpl; let state; doc = staff.staff(); domImpl = doc.implementation; state = domImpl.hasFeature("xml", "1.0"); assert.ok(state, "hasXML1"); }); /** * The "setAttribute(name,value)" method adds a new attribute to the Element Retrieve the last child of the last employee, then add an attribute to it by invoking the "setAttribute(name,value)" method. It should create a "name" attribute with an assigned value equal to "value". * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68F082 */ specify("elementaddnewattribute", () => { let success; let doc; let elementList; let testEmployee; let attrValue; doc = staff.staff(); elementList = doc.getElementsByTagName("address"); testEmployee = elementList.item(4); testEmployee.setAttribute("district", "dallas"); attrValue = testEmployee.getAttribute("district"); assert.equal(attrValue, "dallas", "elementAddNewAttributeAssert"); }); /** * Elements may have attributes associated with them. Retrieve the first attribute from the last child of the first employee and invoke the "getSpecified()" method. This test is only intended to show that Elements can actually have attributes. This test uses the "getNamedItem(name)" method from the NamedNodeMap interface. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-84CF096 */ specify("elementassociatedattribute", () => { let success; let doc; let elementList; let testEmployee; let attributes; let domesticAttr; let specified; doc = staff.staff(); elementList = doc.getElementsByTagName("address"); testEmployee = elementList.item(0); attributes = testEmployee.attributes; domesticAttr = attributes.getNamedItem("domestic"); specified = domesticAttr.specified; assert.ok(specified, "domesticSpecified"); }); /** * The "setAttribute(name,value)" method adds a new attribute to the Element. If the "name" is already present, then its value should be changed to the new one that is in the "value" parameter. Retrieve the last child of the fourth employee, then add an attribute to it by invoking the "setAttribute(name,value)" method. Since the name of the used attribute("street") is already present in this element, then its value should be changed to the new one of the "value" parameter. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68F082 */ specify("elementchangeattributevalue", () => { let success; let doc; let elementList; let testEmployee; let attrValue; doc = staff.staff(); elementList = doc.getElementsByTagName("address"); testEmployee = elementList.item(3); testEmployee.setAttribute("street", "Neither"); attrValue = testEmployee.getAttribute("street"); assert.equal(attrValue, "Neither", "elementChangeAttributeValueAssert"); }); /** * The "setAttributeNode(newAttr)" method adds a new attribute to the Element. Retrieve first address element and add a new attribute node to it by invoking its "setAttributeNode(newAttr)" method. This test makes use of the "createAttribute(name)" method from the Document interface. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-887236154 */ specify("elementcreatenewattribute", () => { let success; let doc; let elementList; let testAddress; let newAttribute; let oldAttr; let districtAttr; let attrVal; doc = staff.staff(); elementList = doc.getElementsByTagName("address"); testAddress = elementList.item(0); newAttribute = doc.createAttribute("district"); oldAttr = testAddress.setAttributeNode(newAttribute); assert.equal(oldAttr, null, "old_attr_doesnt_exist"); districtAttr = testAddress.getAttributeNode("district"); assert.notEqual(districtAttr, null, "new_district_accessible"); attrVal = testAddress.getAttribute("district"); assert.equal(attrVal, "", "attr_value"); }); /** * The "getAttributeNode(name)" method retrieves an attribute node by name. Retrieve the attribute "domestic" from the last child of the first employee. Since the method returns an Attr object, the "name" can be examined to ensure the proper attribute was retrieved. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-217A91B8 */ specify("elementgetattributenode", () => { let success; let doc; let elementList; let testEmployee; let domesticAttr; let name; doc = staff.staff(); elementList = doc.getElementsByTagName("address"); testEmployee = elementList.item(0); domesticAttr = testEmployee.getAttributeNode("domestic"); name = domesticAttr.name; assert.equal(name, "domestic", "elementGetAttributeNodeAssert"); }); /** * The "getAttributeNode(name)" method retrieves an attribute node by name. It should return null if the "name" attribute does not exist. Retrieve the last child of the first employee and attempt to retrieve a non-existing attribute. The method should return "null". The non-existing attribute to be used is "invalidAttribute". * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-217A91B8 */ specify("elementgetattributenodenull", () => { let success; let doc; let elementList; let testEmployee; let domesticAttr; doc = staff.staff(); elementList = doc.getElementsByTagName("address"); testEmployee = elementList.item(0); domesticAttr = testEmployee.getAttributeNode("invalidAttribute"); assert.equal(domesticAttr, null, "elementGetAttributeNodeNullAssert"); }); /** * The "getElementsByTagName(name)" method returns a list of all descendant Elements with the given tag name. Test for an empty list. Create a NodeList of all the descendant elements using the string "noMatch" as the tagName. The method should return a NodeList whose length is "0" since there are not any descendant elements that match the given tag name. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1938918D */ specify("elementgetelementsbytagname", () => { let success; let doc; let elementList; doc = staff.staff(); elementList = doc.getElementsByTagName("employee"); assert.equal(elementList.length, 5, "elementGetElementsByTagNameAssert"); }); /** * Element.getElementsByTagName("employee") should return a NodeList whose length is "5" in the order the children were encountered. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1938918D */ specify("elementgetelementsbytagnameaccessnodelist", () => { let success; let doc; let elementList; let testEmployee; let child; let childName; let childValue; let childType; doc = staff.staff(); elementList = doc.getElementsByTagName("employee"); testEmployee = elementList.item(3); child = testEmployee.firstChild; childType = child.nodeType; if ( (childType === 3) ) { child = child.nextSibling; } childName = child.nodeName; assert.equal(childName, "employeeId", "nodename"); child = child.firstChild; childValue = child.nodeValue; assert.equal(childValue, "EMP0004", "emp0004"); }); /** * The "getElementsByTagName(name)" method returns a list of all descendant Elements with the given tag name. Create a NodeList of all the descendant elements using the string "employee" as the tagName. The method should return a NodeList whose length is "5". * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1938918D */ specify("elementgetelementsbytagnamenomatch", () => { let success; let doc; let elementList; doc = staff.staff(); elementList = doc.getElementsByTagName("noMatch"); assert.equal(elementList.length, 0, "elementGetElementsByTagNameNoMatchNoMatchAssert"); }); /** * The "getElementsByTagName(name)" method may use the special value "*" to match all tags in the element tree. Create a NodeList of all the descendant elements of the last employee by using the special value "*". The method should return all the descendant children(6) in the order the children were encountered. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1938918D */ specify("elementgetelementsbytagnamespecialvalue", () => { let success; let doc; let elementList; let lastEmployee; let lastempList; let child; let childName; let result = new Array(); let expectedResult = new Array(); expectedResult[0] = "employeeId"; expectedResult[1] = "name"; expectedResult[2] = "position"; expectedResult[3] = "salary"; expectedResult[4] = "gender"; expectedResult[5] = "address"; doc = staff.staff(); elementList = doc.getElementsByTagName("employee"); lastEmployee = elementList.item(4); lastempList = lastEmployee.getElementsByTagName("*"); for (let indexN1006A = 0; indexN1006A < lastempList.length; indexN1006A++) { child = lastempList.item(indexN1006A); childName = child.nodeName; result[result.length] = childName; } assert.deepEqual(result, expectedResult, "tagNames"); }); /** * The "getTagName()" method returns the tagName of an element. Invoke the "getTagName()" method one the root node. The value returned should be "staff". * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-104682815 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=251 */ specify("elementgettagname", () => { let success; let doc; let root; let tagname; doc = staff.staff(); root = doc.documentElement; tagname = root.tagName; assert.equal(tagname, "staff", "elementGetTagNameAssert"); }); /** * The "setAttributeNode(newAttr)" method raises an "INUSE_ATTRIBUTE_ERR DOMException if the "newAttr" is already an attribute of another element. Retrieve the last child of the second employee and append a newly created element. The "createAttribute(name)" and "setAttributeNode(newAttr)" methods are invoked to create and add a new attribute to the newly created Element. The "setAttributeNode(newAttr)" method is once again called to add the new attribute causing an exception to be raised since the attribute is already an attribute of another element. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INUSE_ATTRIBUTE_ERR']) * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-887236154 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-887236154')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INUSE_ATTRIBUTE_ERR']) */ specify("elementinuseattributeerr", () => { let success; let doc; let newAttribute; let addressElementList; let testAddress; let newElement; let appendedChild; let setAttr1; let setAttr2; doc = staff.staff(); addressElementList = doc.getElementsByTagName("address"); testAddress = addressElementList.item(1); newElement = doc.createElement("newElement"); appendedChild = testAddress.appendChild(newElement); newAttribute = doc.createAttribute("newAttribute"); setAttr1 = newElement.setAttributeNode(newAttribute); { success = false; try { setAttr2 = testAddress.setAttributeNode(newAttribute); } catch (ex) { success = (typeof (ex.code) !== "undefined" && ex.code === 10); } assert.ok(success, "throw_INUSE_ATTRIBUTE_ERR"); } }); /** * The "setAttribute(name,value)" method raises an "INVALID_CHARACTER_ERR DOMException if the specified name contains an invalid character. Retrieve the last child of the first employee and call its "setAttribute(name,value)" method with "name" containing an invalid character. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INVALID_CHARACTER_ERR']) * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68F082 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-F68F082')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INVALID_CHARACTER_ERR']) * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=249 */ specify("elementinvalidcharacterexception", () => { let success; let doc; let elementList; let testAddress; doc = staff.staff(); elementList = doc.getElementsByTagName("address"); testAddress = elementList.item(0); { success = false; try { testAddress.setAttribute("invalid'Name", "value"); } catch (ex) { success = (typeof (ex.code) !== "undefined" && ex.code === 5); } assert.ok(success, "throw_INVALID_CHARACTER_ERR"); } }); /** * The "normalize()" method puts all the nodes in the full depth of the sub-tree underneath this element into a "normal" form. Retrieve the third employee and access its second child. This child contains a block of text that is spread across multiple lines. The content of the "name" child should be parsed and treated as a single Text node. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-162CF083 */ specify("elementnormalize", () => { let success; let doc; let root; let elementList; let testName; let firstChild; let childValue; doc = staff.staff(); root = doc.documentElement; root.normalize(); elementList = root.getElementsByTagName("name"); testName = elementList.item(2); firstChild = testName.firstChild; childValue = firstChild.nodeValue; assert.equal(childValue, "Roger\n Jones", "elementNormalizeAssert"); }); /** * The "removeAttributeNode(oldAttr)" method raises a NOT_FOUND_ERR DOMException if the "oldAttr" attribute is not an attribute of the element. Retrieve the last employee and attempt to remove a non existing attribute node. This should cause the intended exception to be raised. This test makes use of the "createAttribute(name)" method from the Document interface. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INUSE_ATTRIBUTE_ERR']) * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-D589198 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-D589198')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INUSE_ATTRIBUTE_ERR']) * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=249 */ specify("elementnotfounderr", () => { let success; let doc; let oldAttribute; let addressElementList; let testAddress; let attrAddress; doc = staff.staff(); addressElementList = doc.getElementsByTagName("address"); testAddress = addressElementList.item(4); oldAttribute = doc.createAttribute("oldAttribute"); { success = false; try { attrAddress = testAddress.removeAttributeNode(oldAttribute); } catch (ex) { success = (typeof (ex.code) !== "undefined" && ex.code === 8); } assert.ok(success, "throw_NOT_FOUND_ERR"); } }); /** * The "removeAttributeNode(oldAttr)" method removes the specified attribute. Retrieve the last child of the third employee, add a new "district" node to it and then try to remove it. To verify that the node was removed use the "getNamedItem(name)" method from the NamedNodeMap interface. It also uses the "getAttributes()" method from the Node interface. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-D589198 */ specify("elementremoveattributeaftercreate", () => { let success; let doc; let elementList; let testEmployee; let newAttribute; let attributes; let districtAttr; doc = staff.staff(); elementList = doc.getElementsByTagName("address"); testEmployee = elementList.item(2); newAttribute = doc.createAttribute("district"); districtAttr = testEmployee.setAttributeNode(newAttribute); districtAttr = testEmployee.removeAttributeNode(newAttribute); attributes = testEmployee.attributes; districtAttr = attributes.getNamedItem("district"); assert.equal(districtAttr, null, "elementRemoveAttributeAfterCreateAssert"); }); /** * The "removeAttributeNode(oldAttr)" method returns the node that was removed. Retrieve the last child of the third employee and remove its "street" Attr node. The method should return the old attribute node. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-D589198 */ specify("elementremoveattributenode", () => { let success; let doc; let elementList; let testEmployee; let streetAttr; let removedAttr; let removedValue; doc = staff.staff(); elementList = doc.getElementsByTagName("address"); testEmployee = elementList.item(2); streetAttr = testEmployee.getAttributeNode("street"); removedAttr = testEmployee.removeAttributeNode(streetAttr); removedValue = removedAttr.value; assert.equal(removedValue, "No", "elementRemoveAttributeNodeAssert"); }); /** * This test calls setAttributeNode to replace an attribute with itself. Since the node is not an attribute of another Element, it would be inappropriate to throw an INUSE_ATTRIBUTE_ERR. This test was derived from elementinuserattributeerr which inadvertanly made this test. * @author Curt Arnold * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-887236154 */ specify("elementreplaceattributewithself", () => { let doc = staff.staff(); let testEmployee = doc.getElementsByTagName("address").item(2); let streetAttr = testEmployee.getAttributeNode("street"); let replacedAttr = testEmployee.setAttributeNode(streetAttr); assert.equal(replacedAttr, streetAttr, "replacedAttr"); }); /** * The "setAttributeNode(newAttr)" method adds a new attribute to the Element. If the "newAttr" Attr node is already present in this element, it should replace the existing one. Retrieve the last child of the third employee and add a new attribute node by invoking the "setAttributeNode(new Attr)" method. The new attribute node to be added is "street", which is already present in this element. The method should replace the existing Attr node with the new one. This test uses the "createAttribute(name)" method from the Document interface. * @author NIST * @author Mary Brady */ specify("elementreplaceexistingattribute", () => { let success; let doc; let elementList; let testEmployee; let newAttribute; let name; let setAttr; doc = staff.staff(); elementList = doc.getElementsByTagName("address"); testEmployee = elementList.item(2); newAttribute = doc.createAttribute("street"); setAttr = testEmployee.setAttributeNode(newAttribute); name = testEmployee.getAttribute("street"); assert.equal(name, "", "elementReplaceExistingAttributeAssert"); }); /** * If the "setAttributeNode(newAttr)" method replaces an existing Attr node with the same name, then it should return the previously existing Attr node. Retrieve the last child of the third employee and add a new attribute node. The new attribute node is "street", which is already present in this Element. The method should return the existing Attr node(old "street" Attr). This test uses the "createAttribute(name)" method from the Document interface. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-887236154 */ specify("elementreplaceexistingattributegevalue", () => { let success; let doc; let elementList; let testEmployee; let newAttribute; let streetAttr; let value; doc = staff.staff(); elementList = doc.getElementsByTagName("address"); testEmployee = elementList.item(2); newAttribute = doc.createAttribute("street"); streetAttr = testEmployee.setAttributeNode(newAttribute); value = streetAttr.value; assert.equal(value, "No", "streetNo"); }); /** * The "getAttribute(name)" method returns an attribute value by name. Retrieve the second address element, then invoke the 'getAttribute("street")' method. This should return the value of the attribute("No"). * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-666EE0F9 */ specify("elementretrieveattrvalue", () => { let success; let doc; let elementList; let testAddress; let attrValue; doc = staff.staff(); elementList = doc.getElementsByTagName("address"); testAddress = elementList.item(2); attrValue = testAddress.getAttribute("street"); assert.equal(attrValue, "No", "attrValue"); }); /** * The "getElementsByTagName()" method returns a NodeList of all descendant elements with a given tagName. Invoke the "getElementsByTagName()" method and create a NodeList of "position" elements. Retrieve the second "position" element in the list and return the NodeName. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D095 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-104682815 */ specify("elementretrievetagname", () => { let success; let doc; let elementList; let testEmployee; let name; doc = staff.staff(); elementList = doc.getElementsByTagName("position"); testEmployee = elementList.item(1); name = testEmployee.nodeName; assert.equal(name, "position", "nodename"); name = testEmployee.tagName; assert.equal(name, "position", "tagname"); }); /** * The "setAttributeNode(newAttr)" method returns the null value if no previously existing Attr node with the same name was replaced. Retrieve the last child of the third employee and add a new attribute to it. The new attribute node added is "district", which is not part of this Element. The method should return the null value. This test uses the "createAttribute(name)" method from the Document interface. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-887236154 */ specify("elementsetattributenodenull", () => { let success; let doc; let elementList; let testEmployee; let newAttribute; let districtAttr; doc = staff.staff(); elementList = doc.getElementsByTagName("address"); testEmployee = elementList.item(2); newAttribute = doc.createAttribute("district"); districtAttr = testEmployee.setAttributeNode(newAttribute); assert.equal(districtAttr, null, "elementSetAttributeNodeNullAssert"); }); /** * Create a new DocumentFragment and add a newly created Element node(with one attribute). Once the element is added, its attribute should be available as an attribute associated with an Element within a DocumentFragment. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-35CB04B5 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68F082 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-B63ED1A3 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=236 * @see http://lists.w3.org/Archives/Public/www-dom-ts/2003Jun/0011.html * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=184 */ specify("hc_attrcreatedocumentfragment", () => { let success; let doc; let docFragment; let newOne; let domesticNode; let attributes; let attribute; let attrName; let appendedChild; let langAttrCount = 0; doc = hc_staff.hc_staff(); docFragment = doc.createDocumentFragment(); newOne = doc.createElement("html"); newOne.setAttribute("lang", "EN"); appendedChild = docFragment.appendChild(newOne); domesticNode = docFragment.firstChild; attributes = domesticNode.attributes; for (let indexN10078 = 0; indexN10078 < attributes.length; indexN10078++) { attribute = attributes.item(indexN10078); attrName = attribute.name; if (attrName === "lang") { langAttrCount += 1; } } assert.equal(langAttrCount, 1, "hasLangAttr"); }); /** * The "setValue()" method for an attribute creates a Text node with the unparsed content of the string. Retrieve the attribute named "class" from the last child of of the fourth employee and assign the "Y&ent1;" string to its value attribute. This value is not yet parsed and therefore should still be the same upon retrieval. This test uses the "getNamedItem(name)" method from the NamedNodeMap interface. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-221662474 * @see http://lists.w3.org/Archives/Public/www-dom-ts/2002Apr/0057.html */ specify("hc_attrcreatetextnode", () => { let success; let doc; let addressList; let testNode; let attributes; let streetAttr; let value; doc = hc_staff.hc_staff(); addressList = doc.getElementsByTagName("acronym"); testNode = addressList.item(3); attributes = testNode.attributes; streetAttr = attributes.getNamedItem("class"); streetAttr.value = "Y&ent1;"; value = streetAttr.value; assert.equal(value, "Y&ent1;", "value"); value = streetAttr.nodeValue; assert.equal(value, "Y&ent1;", "nodeValue"); }); /** * The "setNodeValue()" method for an attribute creates a Text node with the unparsed content of the string. Retrieve the attribute named "class" from the last child of of the fourth employee and assign the "Y&ent1;" string to its value attribute. This value is not yet parsed and therefore should still be the same upon retrieval. This test uses the "getNamedItem(name)" method from the NamedNodeMap interface. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D080 * @see http://lists.w3.org/Archives/Public/www-dom-ts/2002Apr/0057.html */ specify("hc_attrcreatetextnode2", () => { let success; let doc; let addressList; let testNode; let attributes; let streetAttr; let value; doc = hc_staff.hc_staff(); addressList = doc.getElementsByTagName("acronym"); testNode = addressList.item(3); attributes = testNode.attributes; streetAttr = attributes.getNamedItem("class"); streetAttr.nodeValue = "Y&ent1;"; value = streetAttr.value; assert.equal(value, "Y&ent1;", "value"); value = streetAttr.nodeValue; assert.equal(value, "Y&ent1;", "nodeValue"); }); /** * If an Attr is explicitly assigned any value, then that value is the attributes effective value. Retrieve the attribute named "domestic" from the last child of of the first employee and examine its nodeValue attribute. This test uses the "getNamedItem(name)" method from the NamedNodeMap interface. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-84CF096 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1074577549 */ specify("hc_attreffectivevalue", () => { let success; let doc; let addressList; let testNode; let attributes; let domesticAttr; let value; doc = hc_staff.hc_staff(); addressList = doc.getElementsByTagName("acronym"); testNode = addressList.item(0); attributes = testNode.attributes; domesticAttr = attributes.getNamedItem("title"); value = domesticAttr.nodeValue; assert.equal(value, "Yes", "attrEffectiveValueAssert"); }); /** * Retrieve the attribute named class from the last child of of the second "p" element and examine its NodeName. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D095 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1112119403 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=236 * @see http://lists.w3.org/Archives/Public/www-dom-ts/2003Jun/0011.html */ specify("hc_attrname", () => { let success; let doc; let addressList; let testNode; let attributes; let streetAttr; let strong1; let strong2; doc = hc_staff.hc_staff(); addressList = doc.getElementsByTagName("acronym"); testNode = addressList.item(1); attributes = testNode.attributes; streetAttr = attributes.getNamedItem("class"); strong1 = streetAttr.name; strong2 = streetAttr.name; assert.equal(strong1, "class", "attribute nodeName"); assert.equal(strong2, "class", "attribute name"); }); /** * The "getSpecified()" method for an Attr node should be set to true if the attribute was explicitly given a value. Retrieve the attribute named "domestic" from the last child of of the first employee and examine the value returned by the "getSpecified()" method. This test uses the "getNamedItem(name)" method from the NamedNodeMap interface. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-862529273 */ specify("hc_attrspecifiedvalue", () => { let success; let doc; let addressList; let testNode; let attributes; let domesticAttr; let state; doc = hc_staff.hc_staff(); addressList = doc.getElementsByTagName("acronym"); testNode = addressList.item(0); attributes = testNode.attributes; domesticAttr = attributes.getNamedItem("title"); state = domesticAttr.specified; assert.ok(state, "acronymTitleSpecified"); }); /** * The "getSpecified()" method for an Attr node should return true if the value of the attribute is changed. Retrieve the attribute named "class" from the last child of of the THIRD employee and change its value to "Yes"(which is the default DTD value). This should cause the "getSpecified()" method to be true. This test uses the "setAttribute(name,value)" method from the Element interface and the "getNamedItem(name)" method from the NamedNodeMap interface. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-862529273 */ specify("hc_attrspecifiedvaluechanged", () => { let success; let doc; let addressList; let testNode; let attributes; let streetAttr; let state; doc = hc_staff.hc_staff(); addressList = doc.getElementsByTagName("acronym"); testNode = addressList.item(2); testNode.setAttribute("class", "Yα"); attributes = testNode.attributes; streetAttr = attributes.getNamedItem("class"); state = streetAttr.specified; assert.ok(state, "acronymClassSpecified"); }); /** * The "appendData(arg)" method appends a string to the end of the character data of the node. Retrieve the character data from the second child of the first employee. The appendData(arg) method is called with arg=", Esquire". The method should append the specified data to the already existing character data. The new value return by the "getLength()" method should be 24. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-32791A2F */ specify("hc_characterdataappenddata", () => { let success; let doc; let elementList; let nameNode; let child; let childValue; let childLength; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("strong"); nameNode = elementList.item(0); child = nameNode.firstChild; child.appendData(", Esquire"); childValue = child.data; childLength = childValue.length; assert.equal(childLength, 24, "characterdataAppendDataAssert"); }); /** * On successful invocation of the "appendData(arg)" method the "getData()" method provides access to the concatentation of data and the specified string. Retrieve the character data from the second child of the first employee. The appendData(arg) method is called with arg=", Esquire". The method should append the specified data to the already existing character data. The new value return by the "getData()" method should be "Margaret Martin, Esquire". * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-32791A2F */ specify("hc_characterdataappenddatagetdata", () => { let success; let doc; let elementList; let nameNode; let child; let childData; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("strong"); nameNode = elementList.item(0); child = nameNode.firstChild; child.appendData(", Esquire"); childData = child.data; assert.equal(childData, "Margaret Martin, Esquire", "characterdataAppendDataGetDataAssert"); }); /** * The "deleteData(offset,count)" method removes a range of characters from the node. Delete data at the beginning of the character data. Retrieve the character data from the last child of the first employee. The "deleteData(offset,count)" method is then called with offset=0 and count=16. The method should delete the characters from position 0 thru position 16. The new value of the character data should be "Dallas, Texas 98551". * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-7C603781 */ specify("hc_characterdatadeletedatabegining", () => { let success; let doc; let elementList; let nameNode; let child; let childData; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("acronym"); nameNode = elementList.item(0); child = nameNode.firstChild; child.deleteData(0, 16); childData = child.data; assert.equal(childData, "Dallas, Texas 98551", "data"); }); /** * The "deleteData(offset,count)" method removes a range of characters from the node. Delete data at the end of the character data. Retrieve the character data from the last child of the first employee. The "deleteData(offset,count)" method is then called with offset=30 and count=5. The method should delete the characters from position 30 thru position 35. The new value of the character data should be "1230 North Ave. Dallas, Texas". * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-7C603781 */ specify("hc_characterdatadeletedataend", () => { let success; let doc; let elementList; let nameNode; let child; let childData; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("acronym"); nameNode = elementList.item(0); child = nameNode.firstChild; child.deleteData(30, 5); childData = child.data; assert.equal(childData, "1230 North Ave. Dallas, Texas ", "characterdataDeleteDataEndAssert"); }); /** * If the sum of the offset and count used in the "deleteData(offset,count) method is greater than the length of the character data then all the characters from the offset to the end of the data are deleted. Retrieve the character data from the last child of the first employee. The "deleteData(offset,count)" method is then called with offset=4 and count=50. The method should delete the characters from position 4 to the end of the data since the offset+count(50+4) is greater than the length of the character data(35). The new value of the character data should be "1230". * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-7C603781 */ specify("hc_characterdatadeletedataexceedslength", () => { let success; let doc; let elementList; let nameNode; let child; let childData; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("acronym"); nameNode = elementList.item(0); child = nameNode.firstChild; child.deleteData(4, 50); childData = child.data; assert.equal(childData, "1230", "characterdataDeleteDataExceedsLengthAssert"); }); /** * On successful invocation of the "deleteData(offset,count)" method, the "getData()" and "getLength()" methods reflect the changes. Retrieve the character data from the last child of the first employee. The "deleteData(offset,count)" method is then called with offset=30 and count=5. The method should delete the characters from position 30 thru position 35. The new value of the character data should be "1230 North Ave. Dallas, Texas" which is returned by the "getData()" method and "getLength()" method should return 30". * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-7D61178C * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-7C603781 */ specify("hc_characterdatadeletedatagetlengthanddata", () => { let success; let doc; let elementList; let nameNode; let child; let childData; let childLength; let result = new Array(); doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("acronym"); nameNode = elementList.item(0); child = nameNode.firstChild; child.deleteData(30, 5); childData = child.data; assert.equal(childData, "1230 North Ave. Dallas, Texas ", "data"); childLength = child.length; assert.equal(childLength, 30, "length"); }); /** * The "deleteData(offset,count)" method removes a range of characters from the node. Delete data in the middle of the character data. Retrieve the character data from the last child of the first employee. The "deleteData(offset,count)" method is then called with offset=16 and count=8. The method should delete the characters from position 16 thru position 24. The new value of the character data should be "1230 North Ave. Texas 98551". * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-7C603781 */ specify("hc_characterdatadeletedatamiddle", () => { let success; let doc; let elementList; let nameNode; let child; let childData; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("acronym"); nameNode = elementList.item(0); child = nameNode.firstChild; child.deleteData(16, 8); childData = child.data; assert.equal(childData, "1230 North Ave. Texas 98551", "characterdataDeleteDataMiddleAssert"); }); /** * The "getData()" method retrieves the character data currently stored in the node. Retrieve the character data from the second child of the first employee and invoke the "getData()" method. The method returns the character data string. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359 */ specify("hc_characterdatagetdata", () => { let success; let doc; let elementList; let nameNode; let child; let childData; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("strong"); nameNode = elementList.item(0); child = nameNode.firstChild; childData = child.data; assert.equal(childData, "Margaret Martin", "characterdataGetDataAssert"); }); /** * The "getLength()" method returns the number of characters stored in this nodes data. Retrieve the character data from the second child of the first employee and examine the value returned by the getLength() method. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-7D61178C */ specify("hc_characterdatagetlength", () => { let success; let doc; let elementList; let nameNode; let child; let childValue; let childLength; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("strong"); nameNode = elementList.item(0); child = nameNode.firstChild; childValue = child.data; childLength = childValue.length; assert.equal(childLength, 15, "characterdataGetLengthAssert"); }); /** * The "deleteData(offset,count)" method works if the specified count is negative. Retrieve the character data of the last child of the first employee and invoke its "deleteData(offset,count)" method with offset=10 and count=-3. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INDEX_SIZE_ERR']) * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-6531BCCF * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-6531BCCF')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INDEX_SIZE_ERR']) */ specify("hc_characterdataindexsizeerrdeletedatacountnegative", () => { let success; let doc; let elementList; let nameNode; let child; let childSubstring; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("acronym"); nameNode = elementList.item(0); child = nameNode.firstChild; childSubstring = child.substringData(10, -3); assert.equal(childSubstring, " Ave. Dallas, Texas 98551"); }); /** * The "deleteData(offset,count)" method raises an INDEX_SIZE_ERR DOMException if the specified offset is greater that the number of characters in the string. Retrieve the character data of the last child of the first employee and invoke its "deleteData(offset,count)" method with offset=40 and count=3. It should raise the desired exception since the offset is greater than the number of characters in the string. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INDEX_SIZE_ERR']) * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-7C603781 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-7C603781')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INDEX_SIZE_ERR']) * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-7C603781 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=249 */ specify("hc_characterdataindexsizeerrdeletedataoffsetgreater", () => { let success; let doc; let elementList; let nameNode; let child; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("acronym"); nameNode = elementList.item(0); child = nameNode.firstChild; { success = false; try { child.deleteData(40, 3); } catch (ex) { success = (typeof (ex.code) !== "undefined" && ex.code === 1); } assert.ok(success, "throw_INDEX_SIZE_ERR"); } }); /** * The "deleteData(offset,count)" method raises an INDEX_SIZE_ERR DOMException if the specified offset is negative. Retrieve the character data of the last child of the first employee and invoke its "deleteData(offset,count)" method with offset=-5 and count=3. It should raise the desired exception since the offset is negative. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INDEX_SIZE_ERR']) * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-7C603781 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-7C603781')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INDEX_SIZE_ERR']) * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-7C603781 */ specify("hc_characterdataindexsizeerrdeletedataoffsetnegative", () => { let success; let doc; let elementList; let nameNode; let child; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("acronym"); nameNode = elementList.item(0); child = nameNode.firstChild; { success = false; try { child.deleteData(-5, 3); } catch (ex) { success = (typeof (ex.code) !== "undefined" && ex.code === 1); } assert.ok(success, "throws_INDEX_SIZE_ERR"); } }); /** * The "insertData(offset,arg)" method raises an INDEX_SIZE_ERR DOMException if the specified offset is greater than the number of characters in the string. Retrieve the character data of the last child of the first employee and invoke its insertData"(offset,arg)" method with offset=40 and arg="ABC". It should raise the desired exception since the offset is greater than the number of characters in the string. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INDEX_SIZE_ERR']) * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-7C603781 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-7C603781')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INDEX_SIZE_ERR']) * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=249 */ specify("hc_characterdataindexsizeerrinsertdataoffsetgreater", () => { let success; let doc; let elementList; let nameNode; let child; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("acronym"); nameNode = elementList.item(0); child = nameNode.firstChild; { success = false; try { child.deleteData(40, 3); } catch (ex) { success = (typeof (ex.code) !== "undefined" && ex.code === 1); } assert.ok(success, "throw_INDEX_SIZE_ERR"); } }); /** * The "insertData(offset,arg)" method raises an INDEX_SIZE_ERR DOMException if the specified offset is negative. Retrieve the character data of the last child of the first employee and invoke its insertData"(offset,arg)" method with offset=-5 and arg="ABC". It should raise the desired exception since the offset is negative. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INDEX_SIZE_ERR']) * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-E5CBA7FB * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-E5CBA7FB')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INDEX_SIZE_ERR']) */ specify("hc_characterdataindexsizeerrinsertdataoffsetnegative", () => { let success; let doc; let elementList; let nameNode; let child; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("acronym"); nameNode = elementList.item(0); child = nameNode.firstChild; { success = false; try { child.replaceData(-5, 3, "ABC"); } catch (ex) { success = (typeof (ex.code) !== "undefined" && ex.code === 1); } assert.ok(success, "throws_INDEX_SIZE_ERR"); } }); /** * The "replaceData(offset,count,arg)" method works if the specified count is negative. Retrieve the character data of the last child of the first employee and invoke its "replaceData(offset,count,arg) method with offset=10 and count=-3 and arg="ABC". * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INDEX_SIZE_ERR']) * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-6531BCCF * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-6531BCCF')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INDEX_SIZE_ERR']) */ specify("hc_characterdataindexsizeerrreplacedatacountnegative", () => { let success; let doc; let elementList; let nameNode; let child; let badString; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("acronym"); nameNode = elementList.item(0); child = nameNode.firstChild; badString = child.substringData(10, -3); assert.equal(badString, " Ave. Dallas, Texas 98551"); }); /** * The "replaceData(offset,count,arg)" method raises an INDEX_SIZE_ERR DOMException if the specified offset is greater than the length of the string. Retrieve the character data of the last child of the first employee and invoke its "replaceData(offset,count,arg) method with offset=40 and count=3 and arg="ABC". It should raise the desired exception since the offset is greater than the length of the string. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INDEX_SIZE_ERR']) * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-7C603781 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-7C603781')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INDEX_SIZE_ERR']) * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=242 */ specify("hc_characterdataindexsizeerrreplacedataoffsetgreater", () => { let success; let doc; let elementList; let nameNode; let child; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("acronym"); nameNode = elementList.item(0); child = nameNode.firstChild; { success = false; try { child.deleteData(40, 3); } catch (ex) { success = (typeof (ex.code) !== "undefined" && ex.code === 1); } assert.ok(success, "throw_INDEX_SIZE_ERR"); } }); /** * The "replaceData(offset,count,arg)" method raises an INDEX_SIZE_ERR DOMException if the specified offset is negative. Retrieve the character data of the last child of the first employee and invoke its "replaceData(offset,count,arg) method with offset=-5 and count=3 and arg="ABC". It should raise the desired exception since the offset is negative. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INDEX_SIZE_ERR']) * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-E5CBA7FB * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-E5CBA7FB')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INDEX_SIZE_ERR']) * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-E5CBA7FB */ specify("hc_characterdataindexsizeerrreplacedataoffsetnegative", () => { let success; let doc; let elementList; let nameNode; let child; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("acronym"); nameNode = elementList.item(0); child = nameNode.firstChild; { success = false; try { child.replaceData(-5, 3, "ABC"); } catch (ex) { success = (typeof (ex.code) !== "undefined" && ex.code === 1); } assert.ok(success, "throws_INDEX_SIZE_ERR"); } }); /** * The "substringData(offset,count)" method works if the specified count is negative. Retrieve the character data of the last child of the first employee and invoke its "substringData(offset,count) method with offset=10 and count=-3. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INDEX_SIZE_ERR']) * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-6531BCCF * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-6531BCCF')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INDEX_SIZE_ERR']) */ specify("hc_characterdataindexsizeerrsubstringcountnegative", () => { let success; let doc; let elementList; let nameNode; let child; let badSubstring; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("acronym"); nameNode = elementList.item(0); child = nameNode.firstChild; badSubstring = child.substringData(10, -3); assert.equal(badSubstring, " Ave. Dallas, Texas 98551"); }); /** * The "substringData(offset,count)" method raises an INDEX_SIZE_ERR DOMException if the specified offset is negative. Retrieve the character data of the last child of the first employee and invoke its "substringData(offset,count) method with offset=-5 and count=3. It should raise the desired exception since the offset is negative. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INDEX_SIZE_ERR']) * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-6531BCCF * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-6531BCCF')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INDEX_SIZE_ERR']) */ specify("hc_characterdataindexsizeerrsubstringnegativeoffset", () => { let success; let doc; let elementList; let nameNode; let child; let badString; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("acronym"); nameNode = elementList.item(0); child = nameNode.firstChild; { success = false; try { badString = child.substringData(-5, 3); } catch (ex) { success = (typeof (ex.code) !== "undefined" && ex.code === 1); } assert.ok(success, "throws_INDEX_SIZE_ERR"); } }); /** * The "substringData(offset,count)" method raises an INDEX_SIZE_ERR DOMException if the specified offset is greater than the number of characters in the string. Retrieve the character data of the last child of the first employee and invoke its "substringData(offset,count) method with offset=40 and count=3. It should raise the desired exception since the offsets value is greater than the length. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INDEX_SIZE_ERR']) * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-6531BCCF * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-6531BCCF')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INDEX_SIZE_ERR']) * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=249 */ specify("hc_characterdataindexsizeerrsubstringoffsetgreater", () => { let success; let doc; let elementList; let nameNode; let child; let badString; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("acronym"); nameNode = elementList.item(0); child = nameNode.firstChild; { success = false; try { badString = child.substringData(40, 3); } catch (ex) { success = (typeof (ex.code) !== "undefined" && ex.code === 1); } assert.ok(success, "throw_INDEX_SIZE_ERR"); } }); /** * The "insertData(offset,arg)" method will insert a string at the specified character offset. Insert the data at the beginning of the character data. Retrieve the character data from the second child of the first employee. The "insertData(offset,arg)" method is then called with offset=0 and arg="Mss.". The method should insert the string "Mss." at position 0. The new value of the character data should be "Mss. Margaret Martin". * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-3EDB695F */ specify("hc_characterdatainsertdatabeginning", () => { let success; let doc; let elementList; let nameNode; let child; let childData; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("strong"); nameNode = elementList.item(0); child = nameNode.firstChild; child.insertData(0, "Mss. "); childData = child.data; assert.equal(childData, "Mss. Margaret Martin", "characterdataInsertDataBeginningAssert"); }); /** * The "insertData(offset,arg)" method will insert a string at the specified character offset. Insert the data at the end of the character data. Retrieve the character data from the second child of the first employee. The "insertData(offset,arg)" method is then called with offset=15 and arg=", Esquire". The method should insert the string ", Esquire" at position 15. The new value of the character data should be "Margaret Martin, Esquire". * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-3EDB695F */ specify("hc_characterdatainsertdataend", () => { let success; let doc; let elementList; let nameNode; let child; let childData; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("strong"); nameNode = elementList.item(0); child = nameNode.firstChild; child.insertData(15, ", Esquire"); childData = child.data; assert.equal(childData, "Margaret Martin, Esquire", "characterdataInsertDataEndAssert"); }); /** * The "insertData(offset,arg)" method will insert a string at the specified character offset. Insert the data in the middle of the character data. Retrieve the character data from the second child of the first employee. The "insertData(offset,arg)" method is then called with offset=9 and arg="Ann". The method should insert the string "Ann" at position 9. The new value of the character data should be "Margaret Ann Martin". * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-3EDB695F */ specify("hc_characterdatainsertdatamiddle", () => { let success; let doc; let elementList; let nameNode; let child; let childData; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("strong"); nameNode = elementList.item(0); child = nameNode.firstChild; child.insertData(9, "Ann "); childData = child.data; assert.equal(childData, "Margaret Ann Martin", "characterdataInsertDataMiddleAssert"); }); /** * The "replaceData(offset,count,arg)" method replaces the characters starting at the specified offset with the specified string. Test for replacement in the middle of the data. Retrieve the character data from the last child of the first employee. The "replaceData(offset,count,arg)" method is then called with offset=5 and count=5 and arg="South". The method should replace characters five thru 9 of the character data with "South". * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-E5CBA7FB */ specify("hc_characterdatareplacedatabegining", () => { let success; let doc; let elementList; let nameNode; let child; let childData; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("acronym"); nameNode = elementList.item(0); child = nameNode.firstChild; child.replaceData(0, 4, "2500"); childData = child.data; assert.equal(childData, "2500 North Ave. Dallas, Texas 98551", "characterdataReplaceDataBeginingAssert"); }); /** * The "replaceData(offset,count,arg)" method replaces the characters starting at the specified offset with the specified string. Test for replacement at the end of the data. Retrieve the character data from the last child of the first employee. The "replaceData(offset,count,arg)" method is then called with offset=30 and count=5 and arg="98665". The method should replace characters 30 thru 34 of the character data with "98665". * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-E5CBA7FB */ specify("hc_characterdatareplacedataend", () => { let success; let doc; let elementList; let nameNode; let child; let childData; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("acronym"); nameNode = elementList.item(0); child = nameNode.firstChild; child.replaceData(30, 5, "98665"); childData = child.data; assert.equal(childData, "1230 North Ave. Dallas, Texas 98665", "characterdataReplaceDataEndAssert"); }); /** * The "replaceData(offset,count,arg)" method replaces the characters starting at the specified offset with the specified string. Test the situation where the length of the arg string is greater than the specified offset. Retrieve the character data from the last child of the first employee. The "replaceData(offset,count,arg)" method is then called with offset=0 and count=4 and arg="260030". The method should replace characters one thru four with "260030". Note that the length of the specified string is greater that the specified offset. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-E5CBA7FB */ specify("hc_characterdatareplacedataexceedslengthofarg", () => { let success; let doc; let elementList; let nameNode; let child; let childData; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("acronym"); nameNode = elementList.item(0); child = nameNode.firstChild; child.replaceData(0, 4, "260030"); childData = child.data; assert.equal( childData, "260030 North Ave. Dallas, Texas 98551", "characterdataReplaceDataExceedsLengthOfArgAssert" ); }); /** * If the sum of the offset and count exceeds the length then all the characters to the end of the data are replaced. Retrieve the character data from the last child of the first employee. The "replaceData(offset,count,arg)" method is then called with offset=0 and count=50 and arg="2600". The method should replace all the characters with "2600". This is because the sum of the offset and count exceeds the length of the character data. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-E5CBA7FB */ specify("hc_characterdatareplacedataexceedslengthofdata", () => { let success; let doc; let elementList; let nameNode; let child; let childData; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("acronym"); nameNode = elementList.item(0); child = nameNode.firstChild; child.replaceData(0, 50, "2600"); childData = child.data; assert.equal(childData, "2600", "characterdataReplaceDataExceedsLengthOfDataAssert"); }); /** * The "replaceData(offset,count,arg)" method replaces the characters starting at the specified offset with the specified string. Test for replacement in the middle of the data. Retrieve the character data from the last child of the first employee. The "replaceData(offset,count,arg)" method is then called with offset=5 and count=5 and arg="South". The method should replace characters five thru 9 of the character data with "South". * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-E5CBA7FB */ specify("hc_characterdatareplacedatamiddle", () => { let success; let doc; let elementList; let nameNode; let child; let childData; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("acronym"); nameNode = elementList.item(0); child = nameNode.firstChild; child.replaceData(5, 5, "South"); childData = child.data; assert.equal(childData, "1230 South Ave. Dallas, Texas 98551", "characterdataReplaceDataMiddleAssert"); }); /** * The "setNodeValue()" method changes the character data currently stored in the node. Retrieve the character data from the second child of the first employee and invoke the "setNodeValue()" method, call "getData()" and compare. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359 */ specify("hc_characterdatasetnodevalue", () => { let success; let doc; let elementList; let nameNode; let child; let childData; let childValue; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("strong"); nameNode = elementList.item(0); child = nameNode.firstChild; child.nodeValue = "Marilyn Martin"; childData = child.data; assert.equal(childData, "Marilyn Martin", "data"); childValue = child.nodeValue; assert.equal(childValue, "Marilyn Martin", "value"); }); /** * If the sum of the "offset" and "count" exceeds the "length" then the "substringData(offset,count)" method returns all the characters to the end of the data. Retrieve the character data from the second child of the first employee and access part of the data by using the substringData(offset,count) method with offset=9 and count=10. The method should return the substring "Martin" since offset+count > length (19 > 15). * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-6531BCCF */ specify("hc_characterdatasubstringexceedsvalue", () => { let success; let doc; let elementList; let nameNode; let child; let substring; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("strong"); nameNode = elementList.item(0); child = nameNode.firstChild; substring = child.substringData(9, 10); assert.equal(substring, "Martin", "characterdataSubStringExceedsValueAssert"); }); /** * The "substringData(offset,count)" method returns the specified string. Retrieve the character data from the second child of the first employee and access part of the data by using the substringData(offset,count) method. The method should return the specified substring starting at position "offset" and extract "count" characters. The method should return the string "Margaret". * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-6531BCCF */ specify("hc_characterdatasubstringvalue", () => { let success; let doc; let elementList; let nameNode; let child; let substring; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("strong"); nameNode = elementList.item(0); child = nameNode.firstChild; substring = child.substringData(0, 8); assert.equal(substring, "Margaret", "characterdataSubStringValueAssert"); }); /** * A comment is all the characters between the starting '' Retrieve the nodes of the DOM document. Search for a comment node and the content is its value. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1334481328 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D095 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D080 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-111237558 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-111237558 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=509 */ specify("hc_commentgetcomment", () => { let doc = hc_staff.hc_staff(); let elementList = doc.childNodes; let commentCount = 0; for (let i = 0; i < elementList.length; i++) { if (elementList.item(i).nodeType === 8) { assert.equal(elementList.item(i).nodeName, "#comment", "nodeName"); assert.equal(elementList.item(i).nodeValue, " This is comment number 1.", "nodeValue"); assert.equal(elementList.item(i).attributes, null, "attributes"); commentCount += 1; } } assert.equal(commentCount, 1, "atMostOneComment"); }); /** * Retrieve the entire DOM document and invoke its "createAttribute(name)" method. It should create a new Attribute node with the given name. The name, value and type of the newly created object are retrieved and output. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1084891198 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=236 * @see http://lists.w3.org/Archives/Public/www-dom-ts/2003Jun/0011.html * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=243 */ specify("hc_documentcreateattribute", () => { let success; let doc; let newAttrNode; let attrValue; let attrName; doc = hc_staff.hc_staff(); newAttrNode = doc.createAttribute("title"); attrValue = newAttrNode.nodeValue; assert.equal(attrValue, "", "value"); attrName = newAttrNode.name; assert.equal(attrName, "title", "attribute name"); }); /** * The "createComment(data)" method creates a new Comment node given the specified string. Retrieve the entire DOM document and invoke its "createComment(data)" method. It should create a new Comment node whose "data" is the specified string. The content, name and type are retrieved and output. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1334481328 */ specify("hc_documentcreatecomment", () => { let success; let doc; let newCommentNode; let newCommentValue; let newCommentName; let newCommentType; doc = hc_staff.hc_staff(); newCommentNode = doc.createComment("This is a new Comment node"); newCommentValue = newCommentNode.nodeValue; assert.equal(newCommentValue, "This is a new Comment node", "value"); newCommentName = newCommentNode.nodeName; assert.equal(newCommentName, "#comment", "strong"); newCommentType = newCommentNode.nodeType; assert.equal(newCommentType, 8, "type"); }); /** * The "createDocumentFragment()" method creates an empty DocumentFragment object. Retrieve the entire DOM document and invoke its "createDocumentFragment()" method. The content, name, type and value of the newly created object are output. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-35CB04B5 */ specify("hc_documentcreatedocumentfragment", () => { let success; let doc; let newDocFragment; let children; let length; let newDocFragmentName; let newDocFragmentType; let newDocFragmentValue; doc = hc_staff.hc_staff(); newDocFragment = doc.createDocumentFragment(); children = newDocFragment.childNodes; length = children.length; assert.equal(length, 0, "length"); newDocFragmentName = newDocFragment.nodeName; assert.equal(newDocFragmentName, "#document-fragment", "strong"); newDocFragmentType = newDocFragment.nodeType; assert.equal(newDocFragmentType, 11, "type"); newDocFragmentValue = newDocFragment.nodeValue; assert.equal(newDocFragmentValue, null, "value"); }); /** * The "createElement(tagName)" method creates an Element of the type specified. Retrieve the entire DOM document and invoke its "createElement(tagName)" method with tagName="acronym". The method should create an instance of an Element node whose tagName is "acronym". The NodeName, NodeType and NodeValue are returned. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-2141741547 */ specify("hc_documentcreateelement", () => { let success; let doc; let newElement; let newElementName; let newElementType; let newElementValue; doc = hc_staff.hc_staff(); newElement = doc.createElement("acronym"); newElementName = newElement.nodeName; assert.equal(newElementName, "acronym", "element strong"); newElementType = newElement.nodeType; assert.equal(newElementType, 1, "type"); newElementValue = newElement.nodeValue; assert.equal(newElementValue, null, "valueInitiallyNull"); }); /** * The tagName parameter in the "createElement(tagName)" method is case-sensitive for XML documents. Retrieve the entire DOM document and invoke its "createElement(tagName)" method twice. Once for tagName equal to "acronym" and once for tagName equal to "ACRONYM" Each call should create a distinct Element node. The newly created Elements are then assigned attributes that are retrieved. Modified on 27 June 2003 to avoid setting an invalid style values and checked the node names to see if they matched expectations. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-2141741547 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=243 */ specify("hc_documentcreateelementcasesensitive", () => { let success; let doc; let newElement1; let newElement2; let attribute1; let attribute2; let nodeName1; let nodeName2; doc = hc_staff.hc_staff(); newElement1 = doc.createElement("ACRONYM"); newElement2 = doc.createElement("acronym"); newElement1.setAttribute("lang", "EN"); newElement2.setAttribute("title", "Dallas"); attribute1 = newElement1.getAttribute("lang"); attribute2 = newElement2.getAttribute("title"); assert.equal(attribute1, "EN", "attrib1"); assert.equal(attribute2, "Dallas", "attrib2"); nodeName1 = newElement1.nodeName; nodeName2 = newElement2.nodeName; assert.equal(nodeName1, "ACRONYM", "element nodeName1"); assert.equal(nodeName2, "acronym", "element nodeName2"); }); /** * The "createTextNode(data)" method creates a Text node given the specfied string. Retrieve the entire DOM document and invoke its "createTextNode(data)" method. It should create a new Text node whose "data" is the specified string. The NodeName and NodeType are also checked. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1975348127 */ specify("hc_documentcreatetextnode", () => { let success; let doc; let newTextNode; let newTextName; let newTextValue; let newTextType; doc = hc_staff.hc_staff(); newTextNode = doc.createTextNode("This is a new Text node"); newTextValue = newTextNode.nodeValue; assert.equal(newTextValue, "This is a new Text node", "value"); newTextName = newTextNode.nodeName; assert.equal(newTextName, "#text", "strong"); newTextType = newTextNode.nodeType; assert.equal(newTextType, 3, "type"); }); /** * Access Document.doctype for hc_staff, if not text/html should return DocumentType node. HTML implementations may return null. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-B63ED1A31 */ specify("hc_documentgetdoctype", () => { let success; let doc; let docType; let docTypeName; let nodeValue; let attributes; doc = hc_staff.hc_staff(); docType = doc.doctype; assert.notEqual(docType, null, "docTypeNotNull"); if (docType !== null) { docTypeName = docType.name; nodeValue = docType.nodeValue; assert.equal(nodeValue, null, "nodeValue"); attributes = docType.attributes; assert.equal(attributes, null, "attributes"); } }); /** * The "getElementsByTagName(tagName)" method returns a NodeList of all the Elements with a given tagName. Retrieve the entire DOM document and invoke its "getElementsByTagName(tagName)" method with tagName equal to "strong". The method should return a NodeList that contains 5 elements. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-A6C9094 */ specify("hc_documentgetelementsbytagnamelength", () => { let success; let doc; let nameList; doc = hc_staff.hc_staff(); nameList = doc.getElementsByTagName("strong"); assert.equal(nameList.length, 5, "documentGetElementsByTagNameLengthAssert"); }); /** * The "getElementsByTagName(tagName)" method returns a NodeList of all the Elements with a given tagName in a pre-order traversal of the tree. Retrieve the entire DOM document and invoke its "getElementsByTagName(tagName)" method with tagName equal to "strong". The method should return a NodeList that contains 5 elements. The FOURTH item in the list is retrieved and output. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-A6C9094 */ specify("hc_documentgetelementsbytagnamevalue", () => { let success; let doc; let nameList; let nameNode; let firstChild; let childValue; doc = hc_staff.hc_staff(); nameList = doc.getElementsByTagName("strong"); nameNode = nameList.item(3); firstChild = nameNode.firstChild; childValue = firstChild.nodeValue; assert.equal(childValue, "Jeny Oconnor", "documentGetElementsByTagNameValueAssert"); }); /** * Retrieve the entire DOM document and invoke its "getImplementation()" method. If contentType="text/html", DOMImplementation.hasFeature("HTML","1.0") should be true. Otherwise, DOMImplementation.hasFeature("XML", "1.0") should be true. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1B793EBA * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=245 */ specify("hc_documentgetimplementation", () => { let success; let doc; let docImpl; let xmlstate; let htmlstate; doc = hc_staff.hc_staff(); docImpl = doc.implementation; xmlstate = docImpl.hasFeature("XML", "1.0"); htmlstate = docImpl.hasFeature("HTML", "1.0"); assert.ok(xmlstate, "supports_XML_1.0"); }); /** * Load a document and invoke its "getDocumentElement()" method. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-87CD092 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=251 */ specify("hc_documentgetrootnode", () => { let success; let doc; let root; let rootName; doc = hc_staff.hc_staff(); root = doc.documentElement; rootName = root.nodeName; assert.equal(rootName, "html", "element docElemName"); }); /** * The "createAttribute(tagName)" method raises an INVALID_CHARACTER_ERR DOMException if the specified tagName contains an invalid character. Retrieve the entire DOM document and invoke its "createAttribute(tagName)" method with the tagName equal to the string "invalid^Name". Due to the invalid character the desired EXCEPTION should be raised. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INVALID_CHARACTER_ERR']) * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1084891198 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-1084891198')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INVALID_CHARACTER_ERR']) * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1084891198 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=249 */ specify("hc_documentinvalidcharacterexceptioncreateattribute", () => { let success; let doc; let createdAttr; doc = hc_staff.hc_staff(); { success = false; try { createdAttr = doc.createAttribute("invalid'Name"); } catch (ex) { success = (typeof (ex.code) !== "undefined" && ex.code === 5); } assert.ok(success, "throw_INVALID_CHARACTER_ERR"); } }); /** * Creating an attribute with an empty name should cause an INVALID_CHARACTER_ERR. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INVALID_CHARACTER_ERR']) * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1084891198 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-1084891198')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INVALID_CHARACTER_ERR']) * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1084891198 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=525 */ specify("hc_documentinvalidcharacterexceptioncreateattribute1", () => { let success; let doc; let createdAttr; doc = hc_staff.hc_staff(); { success = false; try { createdAttr = doc.createAttribute(""); } catch (ex) { success = (typeof (ex.code) !== "undefined" && ex.code === 5); } assert.ok(success, "throw_INVALID_CHARACTER_ERR"); } }); /** * The "createElement(tagName)" method raises an INVALID_CHARACTER_ERR DOMException if the specified tagName contains an invalid character. Retrieve the entire DOM document and invoke its "createElement(tagName)" method with the tagName equal to the string "invalid^Name". Due to the invalid character the desired EXCEPTION should be raised. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INVALID_CHARACTER_ERR']) * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-2141741547 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-2141741547')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INVALID_CHARACTER_ERR']) * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-2141741547 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=249 */ specify("hc_documentinvalidcharacterexceptioncreateelement", () => { let success; let doc; let badElement; doc = hc_staff.hc_staff(); { success = false; try { badElement = doc.createElement("invalid^Name"); } catch (ex) { success = (typeof (ex.code) !== "undefined" && ex.code === 5); } assert.ok(success, "throw_INVALID_CHARACTER_ERR"); } }); /** * Creating an element with an empty name should cause an INVALID_CHARACTER_ERR. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INVALID_CHARACTER_ERR']) * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-2141741547 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-2141741547')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INVALID_CHARACTER_ERR']) * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-2141741547 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=525 */ specify("hc_documentinvalidcharacterexceptioncreateelement1", () => { let success; let doc; let badElement; doc = hc_staff.hc_staff(); { success = false; try { badElement = doc.createElement(""); } catch (ex) { success = (typeof (ex.code) !== "undefined" && ex.code === 5); } assert.ok(success, "throw_INVALID_CHARACTER_ERR"); } }); /** * Load a document and invoke its "getImplementation()" method. This should create a DOMImplementation object whose "hasFeature(feature, version)" method is invoked with version equal to "". If the version is not specified, supporting any version feature will cause the method to return "true". * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-5CED94D7 * @see http://www.w3.org/2000/11/DOM-Level-2-errata#core-14 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=245 */ specify("hc_domimplementationfeaturenoversion", () => { let success; let doc; let domImpl; let state; doc = hc_staff.hc_staff(); domImpl = doc.implementation; state = domImpl.hasFeature("XML", ""); assert.ok(state, "hasFeatureBlank"); }); /** * Load a document and invoke its "getImplementation()" method. This should create a DOMImplementation object whose "hasFeature(feature, version)" method is invoked with version equal to null. If the version is not specified, supporting any version feature will cause the method to return "true". * @author Curt Arnold * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-5CED94D7 * @see http://www.w3.org/2000/11/DOM-Level-2-errata#core-14 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=245 */ specify("hc_domimplementationfeaturenull", () => { let success; let doc; let domImpl; let state; doc = hc_staff.hc_staff(); domImpl = doc.implementation; state = domImpl.hasFeature("XML", null); assert.ok(state, "supports_XML_null"); }); /** * Retrieve the entire DOM document and invoke its "getImplementation()" method. This should create a DOMImplementation object whose "hasFeature(feature, version)" method is invoked with "feature" equal to "html" or "xml". The method should return a boolean "true". * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-5CED94D7 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=245 */ specify("hc_domimplementationfeaturexml", () => { let success; let doc; let domImpl; let state; doc = hc_staff.hc_staff(); domImpl = doc.implementation; state = domImpl.hasFeature("xml", "1.0"); assert.ok(state, "supports_xml_1.0"); }); /** * The "setAttribute(name,value)" method adds a new attribute to the Element Retrieve the last child of the last employee, then add an attribute to it by invoking the "setAttribute(name,value)" method. It should create a "strong" attribute with an assigned value equal to "value". * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68F082 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=243 */ specify("hc_elementaddnewattribute", () => { let success; let doc; let elementList; let testEmployee; let attrValue; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("acronym"); testEmployee = elementList.item(4); testEmployee.setAttribute("lang", "EN-us"); attrValue = testEmployee.getAttribute("lang"); assert.equal(attrValue, "EN-us", "attrValue"); }); /** * Retrieve the first attribute from the last child of the first employee and invoke the "getSpecified()" method. This test is only intended to show that Elements can actually have attributes. This test uses the "getNamedItem(name)" method from the NamedNodeMap interface. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-84CF096 */ specify("hc_elementassociatedattribute", () => { let success; let doc; let elementList; let testEmployee; let attributes; let domesticAttr; let specified; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("acronym"); testEmployee = elementList.item(0); attributes = testEmployee.attributes; domesticAttr = attributes.getNamedItem("title"); specified = domesticAttr.specified; assert.ok(specified, "acronymTitleSpecified"); }); /** * The "setAttribute(name,value)" method adds a new attribute to the Element. If the "strong" is already present, then its value should be changed to the new one that is in the "value" parameter. Retrieve the last child of the fourth employee, then add an attribute to it by invoking the "setAttribute(name,value)" method. Since the name of the used attribute("class") is already present in this element, then its value should be changed to the new one of the "value" parameter. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68F082 */ specify("hc_elementchangeattributevalue", () => { let success; let doc; let elementList; let testEmployee; let attrValue; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("acronym"); testEmployee = elementList.item(3); testEmployee.setAttribute("class", "Neither"); attrValue = testEmployee.getAttribute("class"); assert.equal(attrValue, "Neither", "elementChangeAttributeValueAssert"); }); /** * The "setAttributeNode(newAttr)" method adds a new attribute to the Element. Retrieve first address element and add a new attribute node to it by invoking its "setAttributeNode(newAttr)" method. This test makes use of the "createAttribute(name)" method from the Document interface. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-887236154 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=243 */ specify("hc_elementcreatenewattribute", () => { let success; let doc; let elementList; let testAddress; let newAttribute; let oldAttr; let districtAttr; let attrVal; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("acronym"); testAddress = elementList.item(0); newAttribute = doc.createAttribute("lang"); oldAttr = testAddress.setAttributeNode(newAttribute); assert.equal(oldAttr, null, "old_attr_doesnt_exist"); districtAttr = testAddress.getAttributeNode("lang"); assert.notEqual(districtAttr, null, "new_district_accessible"); attrVal = testAddress.getAttribute("lang"); assert.equal(attrVal, "", "attr_value"); }); /** * Retrieve the attribute "title" from the last child of the first "p" element and check its node name. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-217A91B8 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=236 * @see http://lists.w3.org/Archives/Public/www-dom-ts/2003Jun/0011.html */ specify("hc_elementgetattributenode", () => { let success; let doc; let elementList; let testEmployee; let domesticAttr; let nodeName; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("acronym"); testEmployee = elementList.item(0); domesticAttr = testEmployee.getAttributeNode("title"); nodeName = domesticAttr.name; assert.equal(nodeName, "title", "attribute nodeName"); }); /** * The "getAttributeNode(name)" method retrieves an attribute node by name. It should return null if the "strong" attribute does not exist. Retrieve the last child of the first employee and attempt to retrieve a non-existing attribute. The method should return "null". The non-existing attribute to be used is "invalidAttribute". * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-217A91B8 */ specify("hc_elementgetattributenodenull", () => { let success; let doc; let elementList; let testEmployee; let domesticAttr; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("acronym"); testEmployee = elementList.item(0); domesticAttr = testEmployee.getAttributeNode("invalidAttribute"); assert.equal(domesticAttr, null, "elementGetAttributeNodeNullAssert"); }); /** * The "getAttribute(name)" method returns an empty string if no value was assigned to an attribute and no default value was given in the DTD file. Retrieve the last child of the last employee, then invoke "getAttribute(name)" method, where "strong" is an attribute without a specified or DTD default value. The "getAttribute(name)" method should return the empty string. This method makes use of the "createAttribute(newAttr)" method from the Document interface. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-666EE0F9 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=243 */ specify("hc_elementgetelementempty", () => { let success; let doc; let newAttribute; let elementList; let testEmployee; let domesticAttr; let attrValue; doc = hc_staff.hc_staff(); newAttribute = doc.createAttribute("lang"); elementList = doc.getElementsByTagName("acronym"); testEmployee = elementList.item(3); domesticAttr = testEmployee.setAttributeNode(newAttribute); attrValue = testEmployee.getAttribute("lang"); assert.equal(attrValue, "", "elementGetElementEmptyAssert"); }); /** * The "getElementsByTagName(name)" method returns a list of all descendant Elements with the given tag name. Test for an empty list. Create a NodeList of all the descendant elements using the string "noMatch" as the tagName. The method should return a NodeList whose length is "0" since there are not any descendant elements that match the given tag name. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1938918D */ specify("hc_elementgetelementsbytagname", () => { let success; let doc; let elementList; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("p"); assert.equal(elementList.length, 5, "elementGetElementsByTagNameAssert"); }); /** * The "getElementsByTagName(name)" method returns a list of all descendant Elements in the order the children were encountered in a pre order traversal of the element tree. Create a NodeList of all the descendant elements using the string "p" as the tagName. The method should return a NodeList whose length is "5" in the order the children were encountered. Access the FOURTH element in the NodeList. The FOURTH element, the first or second should be an "em" node with the content "EMP0004". * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1938918D * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=246 */ specify("hc_elementgetelementsbytagnameaccessnodelist", () => { let success; let doc; let elementList; let testEmployee; let firstC; let childName; let nodeType; let employeeIDNode; let employeeID; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("p"); testEmployee = elementList.item(3); firstC = testEmployee.firstChild; nodeType = firstC.nodeType; while ( (nodeType === 3) ) { firstC = firstC.nextSibling; nodeType = firstC.nodeType; } childName = firstC.nodeName; assert.equal(childName, "em", "element childName"); employeeIDNode = firstC.firstChild; employeeID = employeeIDNode.nodeValue; assert.equal(employeeID, "EMP0004", "employeeID"); }); /** * The "getElementsByTagName(name)" method returns a list of all descendant Elements with the given tag name. Create a NodeList of all the descendant elements using the string "employee" as the tagName. The method should return a NodeList whose length is "5". * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1938918D */ specify("hc_elementgetelementsbytagnamenomatch", () => { let success; let doc; let elementList; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("noMatch"); assert.equal(elementList.length, 0, "elementGetElementsByTagNameNoMatchNoMatchAssert"); }); /** * The "getElementsByTagName(name)" method may use the special value "*" to match all tags in the element tree. Create a NodeList of all the descendant elements of the last employee by using the special value "*". The method should return all the descendant children(6) in the order the children were encountered. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1938918D */ specify("hc_elementgetelementsbytagnamespecialvalue", () => { let success; let doc; let elementList; let lastEmployee; let lastempList; let child; let childName; let result = new Array(); let expectedResult = new Array(); expectedResult[0] = "em"; expectedResult[1] = "strong"; expectedResult[2] = "code"; expectedResult[3] = "sup"; expectedResult[4] = "var"; expectedResult[5] = "acronym"; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("p"); lastEmployee = elementList.item(4); lastempList = lastEmployee.getElementsByTagName("*"); for (let indexN10067 = 0; indexN10067 < lastempList.length; indexN10067++) { child = lastempList.item(indexN10067); childName = child.nodeName; result[result.length] = childName; } assert.deepEqual(result, expectedResult, "element tagNames"); }); /** * Invoke the "getTagName()" method one the root node. The value returned should be "html" or "svg". * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-104682815 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=251 */ specify("hc_elementgettagname", () => { let success; let doc; let root; let tagname; doc = hc_staff.hc_staff(); root = doc.documentElement; tagname = root.tagName; assert.equal(tagname, "html", "element tagname"); }); /** * The "setAttributeNode(newAttr)" method raises an "INUSE_ATTRIBUTE_ERR DOMException if the "newAttr" is already an attribute of another element. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INUSE_ATTRIBUTE_ERR']) * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-887236154 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-887236154')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INUSE_ATTRIBUTE_ERR']) * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=244 */ specify("hc_elementinuseattributeerr", () => { let success; let doc; let newAttribute; let addressElementList; let testAddress; let newElement; let attrAddress; let appendedChild; let setAttr1; let setAttr2; doc = hc_staff.hc_staff(); addressElementList = doc.getElementsByTagName("body"); testAddress = addressElementList.item(0); newElement = doc.createElement("p"); appendedChild = testAddress.appendChild(newElement); newAttribute = doc.createAttribute("title"); setAttr1 = newElement.setAttributeNode(newAttribute); { success = false; try { setAttr2 = testAddress.setAttributeNode(newAttribute); } catch (ex) { success = (typeof (ex.code) !== "undefined" && ex.code === 10); } assert.ok(success, "throw_INUSE_ATTRIBUTE_ERR"); } }); /** * The "setAttribute(name,value)" method raises an "INVALID_CHARACTER_ERR DOMException if the specified name contains an invalid character. Retrieve the last child of the first employee and call its "setAttribute(name,value)" method with "strong" containing an invalid character. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INVALID_CHARACTER_ERR']) * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68F082 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-F68F082')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INVALID_CHARACTER_ERR']) * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=249 */ specify("hc_elementinvalidcharacterexception", () => { let success; let doc; let elementList; let testAddress; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("acronym"); testAddress = elementList.item(0); { success = false; try { testAddress.setAttribute("invalid'Name", "value"); } catch (ex) { success = (typeof (ex.code) !== "undefined" && ex.code === 5); } assert.ok(success, "throw_INVALID_CHARACTER_ERR"); } }); /** * Calling Element.setAttribute with an empty name will cause an INVALID_CHARACTER_ERR. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INVALID_CHARACTER_ERR']) * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68F082 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-F68F082')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INVALID_CHARACTER_ERR']) * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=525 */ specify("hc_elementinvalidcharacterexception1", () => { let success; let doc; let elementList; let testAddress; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("acronym"); testAddress = elementList.item(0); { success = false; try { testAddress.setAttribute("", "value"); } catch (ex) { success = (typeof (ex.code) !== "undefined" && ex.code === 5); } assert.ok(success, "throw_INVALID_CHARACTER_ERR"); } }); /** * Append a couple of text nodes to the first sup element, normalize the document element and check that the element has been normalized. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-162CF083 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=546 */ specify("hc_elementnormalize", () => { let success; let doc; let root; let elementList; let testName; let firstChild; let childValue; let textNode; let retNode; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("sup"); testName = elementList.item(0); textNode = doc.createTextNode(""); retNode = testName.appendChild(textNode); textNode = doc.createTextNode(",000"); retNode = testName.appendChild(textNode); root = doc.documentElement; root.normalize(); elementList = doc.getElementsByTagName("sup"); testName = elementList.item(0); firstChild = testName.firstChild; childValue = firstChild.nodeValue; assert.equal(childValue, "56,000,000", "elementNormalizeAssert"); }); /** * The "removeAttributeNode(oldAttr)" method raises a NOT_FOUND_ERR DOMException if the "oldAttr" attribute is not an attribute of the element. Retrieve the last employee and attempt to remove a non existing attribute node. This should cause the intended exception to be raised. This test makes use of the "createAttribute(name)" method from the Document interface. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INUSE_ATTRIBUTE_ERR']) * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-D589198 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-D589198')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INUSE_ATTRIBUTE_ERR']) * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=249 */ specify("hc_elementnotfounderr", () => { let success; let doc; let oldAttribute; let addressElementList; let testAddress; let attrAddress; doc = hc_staff.hc_staff(); addressElementList = doc.getElementsByTagName("acronym"); testAddress = addressElementList.item(4); oldAttribute = doc.createAttribute("title"); { success = false; try { attrAddress = testAddress.removeAttributeNode(oldAttribute); } catch (ex) { success = (typeof (ex.code) !== "undefined" && ex.code === 8); } assert.ok(success, "throw_NOT_FOUND_ERR"); } }); /** * The "removeAttribute(name)" removes an attribute by name. If the attribute has a default value, it is immediately replaced. However, there is no default values in the HTML compatible tests, so its value is "". * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-6D6AC0F9 * @see http://lists.w3.org/Archives/Public/www-dom-ts/2002Mar/0002.html */ specify("hc_elementremoveattribute", () => { let success; let doc; let elementList; let testEmployee; let attrValue; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("acronym"); testEmployee = elementList.item(3); testEmployee.removeAttribute("class"); attrValue = testEmployee.getAttribute("class"); // XXX SUPERSEDED BY DOM4 // test.equal(attrValue, "", 'attrValue'); assert.strictEqual(attrValue, null, "attrValue"); }); /** * The "removeAttributeNode(oldAttr)" method removes the specified attribute. Retrieve the last child of the third employee, add a new "lang" attribute to it and then try to remove it. To verify that the node was removed use the "getNamedItem(name)" method from the NamedNodeMap interface. It also uses the "getAttributes()" method from the Node interface. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-D589198 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=243 */ specify("hc_elementremoveattributeaftercreate", () => { let success; let doc; let elementList; let testEmployee; let newAttribute; let attributes; let districtAttr; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("acronym"); testEmployee = elementList.item(2); newAttribute = doc.createAttribute("lang"); districtAttr = testEmployee.setAttributeNode(newAttribute); districtAttr = testEmployee.removeAttributeNode(newAttribute); attributes = testEmployee.attributes; districtAttr = attributes.getNamedItem("lang"); assert.equal(districtAttr, null, "removed_item_null"); }); /** * The "removeAttributeNode(oldAttr)" method returns the node that was removed. Retrieve the last child of the third employee and remove its "class" Attr node. The method should return the old attribute node. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-D589198 */ specify("hc_elementremoveattributenode", () => { let success; let doc; let elementList; let testEmployee; let streetAttr; let removedAttr; let removedValue; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("acronym"); testEmployee = elementList.item(2); streetAttr = testEmployee.getAttributeNode("class"); removedAttr = testEmployee.removeAttributeNode(streetAttr); assert.notEqual(removedAttr, null, "removedAttrNotNull"); removedValue = removedAttr.value; assert.equal(removedValue, "No", "elementRemoveAttributeNodeAssert"); }); /** * This test calls setAttributeNode to replace an attribute with itself. Since the node is not an attribute of another Element, it would be inappropriate to throw an INUSE_ATTRIBUTE_ERR. This test was derived from elementinuserattributeerr which inadvertanly made this test. * @author Curt Arnold * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-887236154 */ specify("hc_elementreplaceattributewithself", () => { let doc = hc_staff.hc_staff(); let testEmployee = doc.getElementsByTagName("acronym").item(2); let streetAttr = testEmployee.getAttributeNode("class"); let replacedAttr = testEmployee.setAttributeNode(streetAttr); assert.equal(replacedAttr, streetAttr, "replacedAttr"); }); /** * The "setAttributeNode(newAttr)" method adds a new attribute to the Element. If the "newAttr" Attr node is already present in this element, it should replace the existing one. Retrieve the last child of the third employee and add a new attribute node by invoking the "setAttributeNode(new Attr)" method. The new attribute node to be added is "class", which is already present in this element. The method should replace the existing Attr node with the new one. This test uses the "createAttribute(name)" method from the Document interface. * @author Curt Arnold */ specify("hc_elementreplaceexistingattribute", () => { let success; let doc; let elementList; let testEmployee; let newAttribute; let strong; let setAttr; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("acronym"); testEmployee = elementList.item(2); newAttribute = doc.createAttribute("class"); setAttr = testEmployee.setAttributeNode(newAttribute); strong = testEmployee.getAttribute("class"); assert.equal(strong, "", "replacedValue"); }); /** * If the "setAttributeNode(newAttr)" method replaces an existing Attr node with the same name, then it should return the previously existing Attr node. Retrieve the last child of the third employee and add a new attribute node. The new attribute node is "class", which is already present in this Element. The method should return the existing Attr node(old "class" Attr). This test uses the "createAttribute(name)" method from the Document interface. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-887236154 */ specify("hc_elementreplaceexistingattributegevalue", () => { let success; let doc; let elementList; let testEmployee; let newAttribute; let streetAttr; let value; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("acronym"); testEmployee = elementList.item(2); newAttribute = doc.createAttribute("class"); streetAttr = testEmployee.setAttributeNode(newAttribute); assert.notEqual(streetAttr, null, "previousAttrNotNull"); value = streetAttr.value; assert.equal(value, "No", "previousAttrValue"); }); /** * The "getAttribute(name)" method returns an attribute value by name. Retrieve the second address element, then invoke the 'getAttribute("class")' method. This should return the value of the attribute("No"). * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-666EE0F9 */ specify("hc_elementretrieveattrvalue", () => { let success; let doc; let elementList; let testAddress; let attrValue; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("acronym"); testAddress = elementList.item(2); attrValue = testAddress.getAttribute("class"); assert.equal(attrValue, "No", "attrValue"); }); /** * The "getElementsByTagName()" method returns a NodeList of all descendant elements with a given tagName. Invoke the "getElementsByTagName()" method and create a NodeList of "code" elements. Retrieve the second "code" element in the list and return the NodeName. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D095 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-104682815 */ specify("hc_elementretrievetagname", () => { let success; let doc; let elementList; let testEmployee; let strong; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("code"); testEmployee = elementList.item(1); strong = testEmployee.nodeName; assert.equal(strong, "code", "element nodename"); strong = testEmployee.tagName; assert.equal(strong, "code", "element tagname"); }); /** * The "setAttributeNode(newAttr)" method returns the null value if no previously existing Attr node with the same name was replaced. Retrieve the last child of the third employee and add a new attribute to it. The new attribute node added is "lang", which is not part of this Element. The method should return the null value. This test uses the "createAttribute(name)" method from the Document interface. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-887236154 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=243 */ specify("hc_elementsetattributenodenull", () => { let success; let doc; let elementList; let testEmployee; let newAttribute; let districtAttr; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("acronym"); testEmployee = elementList.item(2); newAttribute = doc.createAttribute("lang"); districtAttr = testEmployee.setAttributeNode(newAttribute); assert.equal(districtAttr, null, "elementSetAttributeNodeNullAssert"); }); /** * Retrieve the second "p" element and create a NamedNodeMap listing of the attributes of the last child. Once the list is created an invocation of the "getNamedItem(name)" method is done with name="title". This should result in the title Attr node being returned. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1074577549 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-349467F9 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=236 * @see http://lists.w3.org/Archives/Public/www-dom-ts/2003Jun/0011.html */ specify("hc_namednodemapgetnameditem", () => { let success; let doc; let elementList; let testEmployee; let attributes; let domesticAttr; let attrName; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("acronym"); testEmployee = elementList.item(1); attributes = testEmployee.attributes; domesticAttr = attributes.getNamedItem("title"); attrName = domesticAttr.name; assert.equal(attrName, "title", "attribute nodeName"); }); /** * The "setNamedItem(arg)" method raises a INUSE_ATTRIBUTE_ERR DOMException if "arg" is an Attr that is already in an attribute of another Element. Create a NamedNodeMap object from the attributes of the last child of the third employee and attempt to add an attribute that is already being used by the first employee. This should raise the desired exception. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INUSE_ATTRIBUTE_ERR']) * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1025163788 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-1025163788')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INUSE_ATTRIBUTE_ERR']) * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=249 */ specify("hc_namednodemapinuseattributeerr", () => { let success; let doc; let elementList; let firstNode; let testNode; let attributes; let domesticAttr; let setAttr; let setNode; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("acronym"); firstNode = elementList.item(0); domesticAttr = doc.createAttribute("title"); domesticAttr.value = "YÎ?"; setAttr = firstNode.setAttributeNode(domesticAttr); elementList = doc.getElementsByTagName("acronym"); testNode = elementList.item(2); attributes = testNode.attributes; { success = false; try { setNode = attributes.setNamedItem(domesticAttr); } catch (ex) { success = (typeof (ex.code) !== "undefined" && ex.code === 10); } assert.ok(success, "throw_INUSE_ATTRIBUTE_ERR"); } }); /** * The "removeNamedItem(name)" method raises a NOT_FOUND_ERR DOMException if there is not a node named "strong" in the map. Create a NamedNodeMap object from the attributes of the last child of the third employee and attempt to remove the "lang" attribute. There is not a node named "lang" in the list and therefore the desired exception should be raised. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INUSE_ATTRIBUTE_ERR']) * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-D58B193 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-D58B193')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INUSE_ATTRIBUTE_ERR']) * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=243 */ specify("hc_namednodemapnotfounderr", () => { let success; let doc; let elementList; let testEmployee; let attributes; let removedNode; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("acronym"); testEmployee = elementList.item(2); attributes = testEmployee.attributes; { success = false; try { removedNode = attributes.removeNamedItem("lang"); } catch (ex) { success = (typeof (ex.code) !== "undefined" && ex.code === 8); } assert.ok(success, "throw_NOT_FOUND_ERR"); } }); /** * The "removeNamedItem(name)" method removes a node specified by name. Retrieve the third employee and create a NamedNodeMap object of the attributes of the last child. Once the list is created invoke the "removeNamedItem(name)" method with name="class". This should result in the removal of the specified attribute. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-D58B193 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-349467F9 * @see http://lists.w3.org/Archives/Public/www-dom-ts/2002Mar/0002.html */ specify("hc_namednodemapremovenameditem", () => { let success; let doc; let elementList; let newAttribute; let testAddress; let attributes; let streetAttr; let specified; let removedNode; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("acronym"); testAddress = elementList.item(2); attributes = testAddress.attributes; removedNode = attributes.removeNamedItem("class"); streetAttr = attributes.getNamedItem("class"); assert.equal(streetAttr, null, "isnull"); }); /** * Retrieve the second p element and create a NamedNodeMap listing of the attributes of the last child. Once the list is created an invocation of the "getNamedItem(name)" method is done with name="class". This should result in the method returning an Attr node. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1074577549 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-84CF096 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-637646024 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1112119403 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=236 */ specify("hc_namednodemapreturnattrnode", () => { let success; let doc; let elementList; let testEmployee; let attributes; let streetAttr; let attrName; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("acronym"); testEmployee = elementList.item(1); attributes = testEmployee.attributes; streetAttr = attributes.getNamedItem("class"); attrName = streetAttr.name; assert.equal(attrName, "class", "attribute nodeName"); attrName = streetAttr.name; assert.equal(attrName, "class", "attribute name"); }); /** * The "getNamedItem(name)" method returns null of the specified name did not identify any node in the map. Retrieve the second employee and create a NamedNodeMap listing of the attributes of the last child. Once the list is created an invocation of the "getNamedItem(name)" method is done with name="lang". This name does not match any names in the list therefore the method should return null. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1074577549 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=243 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=249 */ specify("hc_namednodemapreturnnull", () => { let success; let doc; let elementList; let testEmployee; let attributes; let districtNode; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("acronym"); testEmployee = elementList.item(1); attributes = testEmployee.attributes; districtNode = attributes.getNamedItem("lang"); assert.equal(districtNode, null, "langAttrNull"); }); /** * Retrieve the second "p" element and create a NamedNodeMap object from the attributes of the last child by invoking the "getAttributes()" method. Once the list is created an invocation of the "setNamedItem(arg)" method is done with arg=newAttr, where newAttr is a new Attr Node previously created. The "setNamedItem(arg)" method should add then new node to the NamedNodeItem object by using its "nodeName" attribute("lang'). This node is then retrieved using the "getNamedItem(name)" method. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1025163788 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-349467F9 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=236 * @see http://lists.w3.org/Archives/Public/www-dom-ts/2003Jun/0011.html * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=243 */ specify("hc_namednodemapsetnameditem", () => { let success; let doc; let elementList; let newAttribute; let testAddress; let attributes; let districtNode; let attrName; let setNode; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("acronym"); testAddress = elementList.item(1); newAttribute = doc.createAttribute("lang"); attributes = testAddress.attributes; setNode = attributes.setNamedItem(newAttribute); districtNode = attributes.getNamedItem("lang"); attrName = districtNode.name; assert.equal(attrName, "lang", "attribute nodeName"); }); /** * If the "setNamedItem(arg)" method replaces an already existing node with the same name then the already existing node is returned. Retrieve the third employee and create a NamedNodeMap object from the attributes of the last child by invoking the "getAttributes()" method. Once the list is created an invocation of the "setNamedItem(arg)" method is done with arg=newAttr, where newAttr is a new Attr Node previously created and whose node name already exists in the map. The "setNamedItem(arg)" method should replace the already existing node with the new one and return the existing node. This test uses the "createAttribute(name)" method from the document interface. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1025163788 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-349467F9 */ specify("hc_namednodemapsetnameditemreturnvalue", () => { let success; let doc; let elementList; let newAttribute; let testAddress; let attributes; let newNode; let attrValue; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("acronym"); testAddress = elementList.item(2); newAttribute = doc.createAttribute("class"); attributes = testAddress.attributes; newNode = attributes.setNamedItem(newAttribute); assert.notEqual(newNode, null, "previousAttrNotNull"); attrValue = newNode.nodeValue; assert.equal(attrValue, "No", "previousAttrValue"); }); /** * If the node to be added by the "setNamedItem(arg)" method already exists in the NamedNodeMap, it is replaced by the new one. Retrieve the second employee and create a NamedNodeMap object from the attributes of the last child by invoking the "getAttributes()" method. Once the list is created an invocation of the "setNamedItem(arg)" method is done with arg=newAttr, where newAttr is a new Attr Node previously created and whose node name already exists in the map. The "setNamedItem(arg)" method should replace the already existing node with the new one. This node is then retrieved using the "getNamedItem(name)" method. This test uses the "createAttribute(name)" method from the document interface * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1025163788 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-349467F9 */ specify("hc_namednodemapsetnameditemthatexists", () => { let success; let doc; let elementList; let newAttribute; let testAddress; let attributes; let districtNode; let attrValue; let setNode; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("acronym"); testAddress = elementList.item(1); newAttribute = doc.createAttribute("class"); attributes = testAddress.attributes; setNode = attributes.setNamedItem(newAttribute); districtNode = attributes.getNamedItem("class"); attrValue = districtNode.nodeValue; assert.equal(attrValue, "", "namednodemapSetNamedItemThatExistsAssert"); }); /** * If the "setNamedItem(arg)" method does not replace an existing node with the same name then it returns null. Retrieve the third employee and create a NamedNodeMap object from the attributes of the last child. Once the list is created the "setNamedItem(arg)" method is invoked with arg=newAttr, where newAttr is a newly created Attr Node and whose node name already exists in the map. The "setNamedItem(arg)" method should add the new node and return null. This test uses the "createAttribute(name)" method from the document interface. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1025163788 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-349467F9 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=243 */ specify("hc_namednodemapsetnameditemwithnewvalue", () => { let success; let doc; let elementList; let newAttribute; let testAddress; let attributes; let newNode; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("acronym"); testAddress = elementList.item(2); newAttribute = doc.createAttribute("lang"); attributes = testAddress.attributes; newNode = attributes.setNamedItem(newAttribute); assert.equal(newNode, null, "prevValueNull"); }); /** * Retrieve the second "p" and append a "br" Element node to the list of children. The last node in the list is then retrieved and its NodeName examined. The "getNodeName()" method should return "br". * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-184E7107 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=247 */ specify("hc_nodeappendchild", () => { let success; let doc; let elementList; let employeeNode; let childList; let createdNode; let lchild; let childName; let appendedChild; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("p"); employeeNode = elementList.item(1); childList = employeeNode.childNodes; createdNode = doc.createElement("br"); appendedChild = employeeNode.appendChild(createdNode); lchild = employeeNode.lastChild; childName = lchild.nodeName; assert.equal(childName, "br", "element nodeName"); }); /** * If the "newChild" is already in the tree, it is first removed before the new one is appended. Retrieve the "em" second employee and append the first child to the end of the list. After the "appendChild(newChild)" method is invoked the first child should be the one that was second and the last child should be the one that was first. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-184E7107 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=246 */ specify("hc_nodeappendchildchildexists", () => { let success; let doc; let elementList; let childList; let childNode; let newChild; let memberNode; let memberName; let refreshedActual = new Array(); let actual = new Array(); let nodeType; let expected = new Array(); expected[0] = "strong"; expected[1] = "code"; expected[2] = "sup"; expected[3] = "var"; expected[4] = "acronym"; expected[5] = "em"; let appendedChild; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("p"); childNode = elementList.item(1); childList = childNode.getElementsByTagName("*"); newChild = childList.item(0); appendedChild = childNode.appendChild(newChild); for (let indexN10085 = 0; indexN10085 < childList.length; indexN10085++) { memberNode = childList.item(indexN10085); memberName = memberNode.nodeName; actual[actual.length] = memberName; } assert.deepEqual(actual, expected, "element liveByTagName"); childList = childNode.childNodes; for (let indexN1009C = 0; indexN1009C < childList.length; indexN1009C++) { memberNode = childList.item(indexN1009C); nodeType = memberNode.nodeType; if ( (nodeType === 1) ) { memberName = memberNode.nodeName; refreshedActual[refreshedActual.length] = memberName; } } assert.deepEqual(refreshedActual, expected, "element refreshedChildNodes"); }); /** * If the "newChild" is a DocumentFragment object then all its content is added to the child list of this node. Create and populate a new DocumentFragment object and append it to the second employee. After the "appendChild(newChild)" method is invoked retrieve the new nodes at the end of the list, they should be the two Element nodes from the DocumentFragment. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-184E7107 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=246 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=247 */ specify("hc_nodeappendchilddocfragment", () => { let success; let doc; let elementList; let employeeNode; let childList; let newdocFragment; let newChild1; let newChild2; let child; let childName; let result = new Array(); let appendedChild; let nodeType; let expected = new Array(); expected[0] = "em"; expected[1] = "strong"; expected[2] = "code"; expected[3] = "sup"; expected[4] = "var"; expected[5] = "acronym"; expected[6] = "br"; expected[7] = "b"; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("p"); employeeNode = elementList.item(1); childList = employeeNode.childNodes; newdocFragment = doc.createDocumentFragment(); newChild1 = doc.createElement("br"); newChild2 = doc.createElement("b"); appendedChild = newdocFragment.appendChild(newChild1); appendedChild = newdocFragment.appendChild(newChild2); appendedChild = employeeNode.appendChild(newdocFragment); for (let indexN100A2 = 0; indexN100A2 < childList.length; indexN100A2++) { child = childList.item(indexN100A2); nodeType = child.nodeType; if ( (nodeType === 1) ) { childName = child.nodeName; result[result.length] = childName; } } assert.deepEqual(result, expected, "element nodeNames"); }); /** * The "appendChild(newChild)" method returns the node added. Append a newly created node to the child list of the second employee and check the NodeName returned. The "getNodeName()" method should return "br". * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D095 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-184E7107 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=247 */ specify("hc_nodeappendchildgetnodename", () => { let success; let doc; let elementList; let employeeNode; let childList; let newChild; let appendNode; let childName; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("p"); employeeNode = elementList.item(1); childList = employeeNode.childNodes; newChild = doc.createElement("br"); appendNode = employeeNode.appendChild(newChild); childName = appendNode.nodeName; assert.equal(childName, "br", "element nodeName"); }); /** * The "appendChild(newChild)" method raises a HIERARCHY_REQUEST_ERR DOMException if the node to append is one of this node's ancestors. Retrieve the second employee and attempt to append an ancestor node(root node) to it. An attempt to make such an addition should raise the desired exception. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='HIERARCHY_REQUEST_ERR']) * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-184E7107 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-184E7107')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='HIERARCHY_REQUEST_ERR']) * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-184E7107 */ specify("hc_nodeappendchildnodeancestor", () => { let success; let doc; let newChild; let elementList; let employeeNode; let childList; let oldChild; let appendedChild; doc = hc_staff.hc_staff(); newChild = doc.documentElement; elementList = doc.getElementsByTagName("p"); employeeNode = elementList.item(1); { success = false; try { appendedChild = employeeNode.appendChild(newChild); } catch (ex) { success = (typeof (ex.code) !== "undefined" && ex.code === 3); } assert.ok(success, "throw_HIERARCHY_REQUEST_ERR"); } }); /** * The "getAttributes()" method invoked on an Attribute Node returns null. Retrieve the first attribute from the last child of the first employee and invoke the "getAttributes()" method on the Attribute Node. It should return null. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-84CF096 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-637646024 */ specify("hc_nodeattributenodeattribute", () => { let success; let doc; let elementList; let testAddr; let addrAttr; let attrNode; let attrList; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("acronym"); testAddr = elementList.item(0); addrAttr = testAddr.attributes; attrNode = addrAttr.item(0); attrList = attrNode.attributes; assert.equal(attrList, null, "nodeAttributeNodeAttributeAssert1"); }); /** * Retrieve the Attribute named "title" from the last child of the first p element and check the string returned by the "getNodeName()" method. It should be equal to "title". * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D095 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=236 */ specify("hc_nodeattributenodename", () => { let success; let doc; let elementList; let testAddr; let addrAttr; let attrName; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("acronym"); testAddr = elementList.item(0); addrAttr = testAddr.getAttributeNode("title"); attrName = addrAttr.name; assert.equal(attrName, "title", "attribute nodeName"); }); /** * The string returned by the "getNodeValue()" method for an Attribute Node is the value of the Attribute. Retrieve the Attribute named "title" from the last child of the first "p" and check the string returned by the "getNodeValue()" method. It should be equal to "Yes". * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D080 */ specify("hc_nodeattributenodevalue", () => { let success; let doc; let elementList; let testAddr; let addrAttr; let attrValue; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("acronym"); testAddr = elementList.item(0); addrAttr = testAddr.getAttributeNode("title"); attrValue = addrAttr.nodeValue; assert.equal(attrValue, "Yes", "nodeValue"); }); /** * The "getChildNodes()" method returns a NodeList that contains all children of this node. Retrieve the second employee and check the NodeList returned by the "getChildNodes()" method. The length of the list should be 13. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1451460987 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=246 */ specify("hc_nodechildnodes", () => { let success; let doc; let elementList; let employeeNode; let childNode; let childNodes; let nodeType; let childName; let actual = new Array(); let expected = new Array(); expected[0] = "em"; expected[1] = "strong"; expected[2] = "code"; expected[3] = "sup"; expected[4] = "var"; expected[5] = "acronym"; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("p"); employeeNode = elementList.item(1); childNodes = employeeNode.childNodes; for (let indexN1006C = 0; indexN1006C < childNodes.length; indexN1006C++) { childNode = childNodes.item(indexN1006C); nodeType = childNode.nodeType; childName = childNode.nodeName; if ( (nodeType === 1) ) { actual[actual.length] = childName; } else { assert.equal(nodeType, 3, "textNodeType"); } } assert.deepEqual(actual, expected, "element elementNames"); }); /** * The NodeList returned by the "getChildNodes()" method is live. Changes on the node's children are immediately reflected on the nodes returned in the NodeList. Create a NodeList of the children of the second employee and then add a newly created element that was created by the "createElement()" method(Document Interface) to the second employee by using the "appendChild()" method. The length of the NodeList should reflect this new addition to the child list. It should return the value 14. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1451460987 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-184E7107 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=246 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=247 */ specify("hc_nodechildnodesappendchild", () => { let success; let doc; let elementList; let employeeNode; let childList; let createdNode; let childNode; let childName; let childType; let textNode; let actual = new Array(); let expected = new Array(); expected[0] = "em"; expected[1] = "strong"; expected[2] = "code"; expected[3] = "sup"; expected[4] = "var"; expected[5] = "acronym"; expected[6] = "br"; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("p"); employeeNode = elementList.item(1); childList = employeeNode.childNodes; createdNode = doc.createElement("br"); employeeNode = employeeNode.appendChild(createdNode); for (let indexN10087 = 0; indexN10087 < childList.length; indexN10087++) { childNode = childList.item(indexN10087); childName = childNode.nodeName; childType = childNode.nodeType; if ( (childType === 1) ) { actual[actual.length] = childName; } else { assert.equal(childType, 3, "textNodeType"); } } assert.deepEqual(actual, expected, "element childElements"); }); /** * The "getChildNodes()" method returns a NodeList that contains all children of this node. If there are not any children, this is a NodeList that does not contain any nodes. Retrieve the character data of the second "em" node and invoke the "getChildNodes()" method. The NodeList returned should not have any nodes. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1451460987 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=246 */ specify("hc_nodechildnodesempty", () => { let success; let doc; let elementList; let childList; let employeeNode; let textNode; let length; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("em"); employeeNode = elementList.item(1); textNode = employeeNode.firstChild; childList = textNode.childNodes; length = childList.length; assert.equal(length, 0, "length_zero"); }); /** * Retrieve the second acronym element and invoke the cloneNode method. The duplicate node returned by the method should copy the attributes associated with this node. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-84CF096 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=236 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=184 */ specify("hc_nodecloneattributescopied", () => { let doc = hc_staff.hc_staff(); let attributes = doc.getElementsByTagName("acronym").item(1).cloneNode(false).attributes; let actual = []; for (let i = 0; i < attributes.length; i++) { actual.push(attributes.item(i).name); } assert.deepEqual(actual, ["title", "class"], "names"); }); /** * The "cloneNode(deep)" method does not copy text unless it is deep cloned.(Test for deep=false) Retrieve the fourth child of the second employee and the "cloneNode(deep)" method with deep=false. The duplicate node returned by the method should not copy any text data contained in this node. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-3A0ED0A4 */ specify("hc_nodeclonefalsenocopytext", () => { let success; let doc; let elementList; let employeeNode; let childList; let childNode; let clonedNode; let lastChildNode; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("p"); employeeNode = elementList.item(1); childList = employeeNode.childNodes; childNode = childList.item(3); clonedNode = childNode.cloneNode(false); lastChildNode = clonedNode.lastChild; assert.equal(lastChildNode, null, "nodeCloneFalseNoCopyTextAssert1"); }); /** * The duplicate node returned by the "cloneNode(deep)" method does not have a ParentNode. Retrieve the second employee and invoke the "cloneNode(deep)" method with deep=false. The duplicate node returned should return null when the "getParentNode()" is invoked. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-3A0ED0A4 */ specify("hc_nodeclonegetparentnull", () => { let success; let doc; let elementList; let employeeNode; let clonedNode; let parentNode; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("p"); employeeNode = elementList.item(1); clonedNode = employeeNode.cloneNode(false); parentNode = clonedNode.parentNode; assert.equal(parentNode, null, "nodeCloneGetParentNullAssert1"); }); /** * The "cloneNode(deep)" method returns a copy of the node only if deep=false. Retrieve the second employee and invoke the "cloneNode(deep)" method with deep=false. The method should only clone this node. The NodeName and length of the NodeList are checked. The "getNodeName()" method should return "employee" and the "getLength()" method should return 0. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-3A0ED0A4 */ specify("hc_nodeclonenodefalse", () => { let success; let doc; let elementList; let employeeNode; let clonedNode; let cloneName; let cloneChildren; let length; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("p"); employeeNode = elementList.item(1); clonedNode = employeeNode.cloneNode(false); cloneName = clonedNode.nodeName; assert.equal(cloneName, "p", "element strong"); cloneChildren = clonedNode.childNodes; length = cloneChildren.length; assert.equal(length, 0, "length"); }); /** * The "cloneNode(deep)" method returns a copy of the node and the subtree under it if deep=true. Retrieve the second employee and invoke the "cloneNode(deep)" method with deep=true. The method should clone this node and the subtree under it. The NodeName of each child in the returned node is checked to insure the entire subtree under the second employee was cloned. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-3A0ED0A4 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=246 */ specify("hc_nodeclonenodetrue", () => { let success; let doc; let elementList; let employeeNode; let clonedNode; let clonedList; let clonedChild; let clonedChildName; let origList; let origChild; let origChildName; let result = new Array(); let expected = new Array(); doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("p"); employeeNode = elementList.item(1); origList = employeeNode.childNodes; for (let indexN10065 = 0; indexN10065 < origList.length; indexN10065++) { origChild = origList.item(indexN10065); origChildName = origChild.nodeName; expected[expected.length] = origChildName; } clonedNode = employeeNode.cloneNode(true); clonedList = clonedNode.childNodes; for (let indexN1007B = 0; indexN1007B < clonedList.length; indexN1007B++) { clonedChild = clonedList.item(indexN1007B); clonedChildName = clonedChild.nodeName; result[result.length] = clonedChildName; } assert.deepEqual(result, expected, "clone"); }); /** * The "cloneNode(deep)" method does not copy text unless it is deep cloned.(Test for deep=true) Retrieve the eighth child of the second employee and the "cloneNode(deep)" method with deep=true. The duplicate node returned by the method should copy any text data contained in this node. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-3A0ED0A4 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=246 */ specify("hc_nodeclonetruecopytext", () => { let success; let doc; let elementList; let childNode; let clonedNode; let lastChildNode; let childValue; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("sup"); childNode = elementList.item(1); clonedNode = childNode.cloneNode(true); lastChildNode = clonedNode.lastChild; childValue = lastChildNode.nodeValue; assert.equal(childValue, "35,000", "cloneContainsText"); }); /** * The "getAttributes()" method invoked on a Comment Node returns null. Find any comment that is an immediate child of the root and assert that Node.attributes is null. Then create a new comment node (in case they had been omitted) and make the assertion. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-84CF096 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1728279322 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=248 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=263 */ specify("hc_nodecommentnodeattributes", () => { let success; let doc; let commentNode; let nodeList; let attrList; let nodeType; doc = hc_staff.hc_staff(); nodeList = doc.childNodes; for (let indexN10043 = 0; indexN10043 < nodeList.length; indexN10043++) { commentNode = nodeList.item(indexN10043); nodeType = commentNode.nodeType; if ( (nodeType === 8) ) { attrList = commentNode.attributes; assert.equal(attrList, null, "existingCommentAttributesNull"); } } commentNode = doc.createComment("This is a comment"); attrList = commentNode.attributes; assert.equal(attrList, null, "createdCommentAttributesNull"); }); /** * The string returned by the "getNodeName()" method for a Comment Node is "#comment". Retrieve the Comment node in the XML file and check the string returned by the "getNodeName()" method. It should be equal to "#comment". * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D095 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1728279322 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=248 */ specify("hc_nodecommentnodename", () => { let success; let doc; let elementList; let commentNode; let nodeType; let commentName; let commentNodeName; doc = hc_staff.hc_staff(); elementList = doc.childNodes; for (let indexN10044 = 0; indexN10044 < elementList.length; indexN10044++) { commentNode = elementList.item(indexN10044); nodeType = commentNode.nodeType; if ( (nodeType === 8) ) { commentNodeName = commentNode.nodeName; assert.equal(commentNodeName, "#comment", "existingNodeName"); } } commentNode = doc.createComment("This is a comment"); commentNodeName = commentNode.nodeName; assert.equal(commentNodeName, "#comment", "createdNodeName"); }); /** * The "getNodeType()" method for a Comment Node returns the constant value 8. Retrieve the nodes from the document and check for a comment node and invoke the "getNodeType()" method. This should return 8. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-111237558 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1728279322 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=248 */ specify("hc_nodecommentnodetype", () => { let success; let doc; let testList; let commentNode; let commentNodeName; let nodeType; doc = hc_staff.hc_staff(); testList = doc.childNodes; for (let indexN10040 = 0; indexN10040 < testList.length; indexN10040++) { commentNode = testList.item(indexN10040); commentNodeName = commentNode.nodeName; if ( (commentNodeName === "#comment") ) { nodeType = commentNode.nodeType; assert.equal(nodeType, 8, "existingCommentNodeType"); } } commentNode = doc.createComment("This is a comment"); nodeType = commentNode.nodeType; assert.equal(nodeType, 8, "createdCommentNodeType"); }); /** * The string returned by the "getNodeValue()" method for a Comment Node is the content of the comment. Retrieve the comment in the XML file and check the string returned by the "getNodeValue()" method. It should be equal to "This is comment number 1". * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D080 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1728279322 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=248 */ specify("hc_nodecommentnodevalue", () => { let success; let doc; let elementList; let commentNode; let commentName; let commentValue; doc = hc_staff.hc_staff(); elementList = doc.childNodes; for (let indexN10040 = 0; indexN10040 < elementList.length; indexN10040++) { commentNode = elementList.item(indexN10040); commentName = commentNode.nodeName; if ( (commentName === "#comment") ) { commentValue = commentNode.nodeValue; assert.equal(commentValue, " This is comment number 1.", "value"); } } commentNode = doc.createComment(" This is a comment"); commentValue = commentNode.nodeValue; assert.equal(commentValue, " This is a comment", "createdCommentNodeValue"); }); /** * The string returned by the "getNodeName()" method for a DocumentFragment Node is "#document-frament". Retrieve the DOM document and invoke the "createDocumentFragment()" method and check the string returned by the "getNodeName()" method. It should be equal to "#document-fragment". * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D095 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-B63ED1A3 */ specify("hc_nodedocumentfragmentnodename", () => { let success; let doc; let docFragment; let documentFragmentName; doc = hc_staff.hc_staff(); docFragment = doc.createDocumentFragment(); documentFragmentName = docFragment.nodeName; assert.equal(documentFragmentName, "#document-fragment", "nodeDocumentFragmentNodeNameAssert1"); }); /** * The "getNodeType()" method for a DocumentFragment Node returns the constant value 11. Invoke the "createDocumentFragment()" method and examine the NodeType of the document fragment returned by the "getNodeType()" method. The method should return 11. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-111237558 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-B63ED1A3 */ specify("hc_nodedocumentfragmentnodetype", () => { let success; let doc; let documentFragmentNode; let nodeType; doc = hc_staff.hc_staff(); documentFragmentNode = doc.createDocumentFragment(); nodeType = documentFragmentNode.nodeType; assert.equal(nodeType, 11, "nodeDocumentFragmentNodeTypeAssert1"); }); /** * The string returned by the "getNodeValue()" method for a DocumentFragment Node is null. Retrieve the DOM document and invoke the "createDocumentFragment()" method and check the string returned by the "getNodeValue()" method. It should be equal to null. * @author Curt Arnold * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-B63ED1A3 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D080 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-84CF096 */ specify("hc_nodedocumentfragmentnodevalue", () => { let success; let doc; let docFragment; let attrList; let value; doc = hc_staff.hc_staff(); docFragment = doc.createDocumentFragment(); attrList = docFragment.attributes; assert.equal(attrList, null, "attributesNull"); value = docFragment.nodeValue; assert.equal(value, null, "initiallyNull"); }); /** * The "getAttributes()" method invoked on a Document Node returns null. Retrieve the DOM Document and invoke the "getAttributes()" method on the Document Node. It should return null. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-84CF096 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#i-Document */ specify("hc_nodedocumentnodeattribute", () => { let success; let doc; let attrList; doc = hc_staff.hc_staff(); attrList = doc.attributes; assert.equal(attrList, null, "doc_attributes_is_null"); }); /** * The string returned by the "getNodeName()" method for a Document Node is "#document". Retrieve the DOM document and check the string returned by the "getNodeName()" method. It should be equal to "#document". * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#i-Document * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D095 */ specify("hc_nodedocumentnodename", () => { let success; let doc; let documentName; doc = hc_staff.hc_staff(); documentName = doc.nodeName; assert.equal(documentName, "#document", "documentNodeName"); }); /** * The "getNodeType()" method for a Document Node returns the constant value 9. Retrieve the document and invoke the "getNodeType()" method. The method should return 9. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#i-Document * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-111237558 */ specify("hc_nodedocumentnodetype", () => { let success; let doc; let nodeType; doc = hc_staff.hc_staff(); nodeType = doc.nodeType; assert.equal(nodeType, 9, "nodeDocumentNodeTypeAssert1"); }); /** * The string returned by the "getNodeValue()" method for a Document Node is null. Retrieve the DOM Document and check the string returned by the "getNodeValue()" method. It should be equal to null. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#i-Document * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D080 */ specify("hc_nodedocumentnodevalue", () => { let doc = hc_staff.hc_staff(); assert.equal(doc.nodeValue, null, "documentNodeValue"); }); /** * Retrieve the first Element Node(Root Node) of the DOM object and check the string returned by the "getNodeName()" method. It should be equal to its tagName. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D095 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=251 */ specify("hc_nodeelementnodename", () => { let success; let doc; let elementNode; let elementName; doc = hc_staff.hc_staff(); elementNode = doc.documentElement; elementName = elementNode.nodeName; assert.equal(elementName, "html", "element nodeName"); }); /** * The "getNodeType()" method for an Element Node returns the constant value 1. Retrieve the root node and invoke the "getNodeType()" method. The method should return 1. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-111237558 */ specify("hc_nodeelementnodetype", () => { let success; let doc; let rootNode; let nodeType; doc = hc_staff.hc_staff(); rootNode = doc.documentElement; nodeType = rootNode.nodeType; assert.equal(nodeType, 1, "nodeElementNodeTypeAssert1"); }); /** * The string returned by the "getNodeValue()" method for an Element Node is null. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D080 */ specify("hc_nodeelementnodevalue", () => { let success; let doc; let elementNode; let elementValue; doc = hc_staff.hc_staff(); elementNode = doc.documentElement; elementValue = elementNode.nodeValue; assert.equal(elementValue, null, "elementNodeValue"); }); /** * The "getFirstChild()" method returns the first child of this node. Retrieve the second employee and invoke the "getFirstChild()" method. The NodeName returned should be "#text" or "EM". * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-169727388 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=246 */ specify("hc_nodegetfirstchild", () => { let success; let doc; let elementList; let employeeNode; let fchildNode; let childName; let nodeType; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("p"); employeeNode = elementList.item(1); fchildNode = employeeNode.firstChild; childName = fchildNode.nodeName; if ( (childName === "#text") ) { assert.equal(childName, "#text", "firstChild_w_whitespace"); } else { assert.equal(childName, "em", "element firstChild_wo_whitespace"); } }); /** * If there is not a first child then the "getFirstChild()" method returns null. Retrieve the text of the first "em" element and invoke the "getFirstChild()" method. It should return null. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-169727388 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=246 */ specify("hc_nodegetfirstchildnull", () => { let success; let doc; let emList; let emNode; let emText; let nullChild; doc = hc_staff.hc_staff(); emList = doc.getElementsByTagName("em"); emNode = emList.item(0); emText = emNode.firstChild; nullChild = emText.firstChild; assert.equal(nullChild, null, "nullChild"); }); /** * The "getLastChild()" method returns the last child of this node. Retrieve the second employee and invoke the "getLastChild()" method. The NodeName returned should be "#text". * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-61AD09FB */ specify("hc_nodegetlastchild", () => { let success; let doc; let elementList; let employeeNode; let lchildNode; let childName; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("p"); employeeNode = elementList.item(1); lchildNode = employeeNode.lastChild; childName = lchildNode.nodeName; assert.equal(childName, "#text", "whitespace"); }); /** * If there is not a last child then the "getLastChild()" method returns null. Retrieve the text of the first "em" element and invoke the "getFirstChild()" method. It should return null. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-61AD09FB * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=246 */ specify("hc_nodegetlastchildnull", () => { let success; let doc; let emList; let emNode; let emText; let nullChild; doc = hc_staff.hc_staff(); emList = doc.getElementsByTagName("em"); emNode = emList.item(0); emText = emNode.firstChild; nullChild = emText.lastChild; assert.equal(nullChild, null, "nullChild"); }); /** * The "getNextSibling()" method returns the node immediately following this node. Retrieve the first child of the second employee and invoke the "getNextSibling()" method. It should return a node with the NodeName of "#text". * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-6AC54C2F */ specify("hc_nodegetnextsibling", () => { let success; let doc; let elementList; let emNode; let nsNode; let nsName; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("em"); emNode = elementList.item(1); nsNode = emNode.nextSibling; nsName = nsNode.nodeName; assert.equal(nsName, "#text", "whitespace"); }); /** * If there is not a node immediately following this node the "getNextSibling()" method returns null. Retrieve the first child of the second employee and invoke the "getNextSibling()" method. It should be set to null. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-6AC54C2F */ specify("hc_nodegetnextsiblingnull", () => { let success; let doc; let elementList; let employeeNode; let lcNode; let nsNode; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("p"); employeeNode = elementList.item(1); lcNode = employeeNode.lastChild; nsNode = lcNode.nextSibling; assert.equal(nsNode, null, "nodeGetNextSiblingNullAssert1"); }); /** * Evaluate Node.ownerDocument on the second "p" element. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#node-ownerDoc * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=251 */ specify("hc_nodegetownerdocument", () => { let success; let doc; let elementList; let docNode; let ownerDocument; let docElement; let elementName; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("p"); docNode = elementList.item(1); ownerDocument = docNode.ownerDocument; docElement = ownerDocument.documentElement; elementName = docElement.nodeName; assert.equal(elementName, "html", "element ownerDocElemTagName"); }); /** * The "getOwnerDocument()" method returns null if the target node itself is a document. Invoke the "getOwnerDocument()" method on the master document. The Document returned should be null. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#node-ownerDoc */ specify("hc_nodegetownerdocumentnull", () => { let success; let doc; let ownerDocument; doc = hc_staff.hc_staff(); ownerDocument = doc.ownerDocument; assert.equal(ownerDocument, null, "nodeGetOwnerDocumentNullAssert1"); }); /** * The "getPreviousSibling()" method returns the node immediately preceding this node. Retrieve the second child of the second employee and invoke the "getPreviousSibling()" method. It should return a node with a NodeName of "#text". * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-640FB3C8 */ specify("hc_nodegetprevioussibling", () => { let success; let doc; let elementList; let nameNode; let psNode; let psName; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("strong"); nameNode = elementList.item(1); psNode = nameNode.previousSibling; psName = psNode.nodeName; assert.equal(psName, "#text", "whitespace"); }); /** * If there is not a node immediately preceding this node the "getPreviousSibling()" method returns null. Retrieve the first child of the second employee and invoke the "getPreviousSibling()" method. It should be set to null. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-640FB3C8 */ specify("hc_nodegetprevioussiblingnull", () => { let success; let doc; let elementList; let employeeNode; let fcNode; let psNode; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("p"); employeeNode = elementList.item(2); fcNode = employeeNode.firstChild; psNode = fcNode.previousSibling; assert.equal(psNode, null, "nodeGetPreviousSiblingNullAssert1"); }); /** * The "hasChildNodes()" method returns true if the node has children. Retrieve the root node("staff") and invoke the "hasChildNodes()" method. It should return the boolean value "true". * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-810594187 */ specify("hc_nodehaschildnodes", () => { let success; let doc; let elementList; let employeeNode; let state; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("p"); employeeNode = elementList.item(1); state = employeeNode.hasChildNodes(); assert.ok(state, "nodeHasChildAssert1"); }); /** * The "hasChildNodes()" method returns false if the node does not have any children. Retrieve the text of the first "em" element and invoke the "hasChildNodes()" method. It should return false. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1451460987 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-810594187 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=246 */ specify("hc_nodehaschildnodesfalse", () => { let success; let doc; let emList; let emNode; let emText; let hasChild; doc = hc_staff.hc_staff(); emList = doc.getElementsByTagName("em"); emNode = emList.item(0); emText = emNode.firstChild; hasChild = emText.hasChildNodes(); assert.equal(hasChild, false, "hasChild"); }); /** * The "insertBefore(newChild,refChild)" method inserts the node "newChild" before the node "refChild". Insert a newly created Element node before the second sup element in the document and check the "newChild" and "refChild" after insertion for correct placement. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-952280727 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=246 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=247 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=261 */ specify("hc_nodeinsertbefore", () => { let success; let doc; let elementList; let employeeNode; let childList; let refChild; let newChild; let child; let childName; let insertedNode; let actual = new Array(); let expected = new Array(); expected[0] = "em"; expected[1] = "strong"; expected[2] = "code"; expected[3] = "br"; expected[4] = "sup"; expected[5] = "var"; expected[6] = "acronym"; let nodeType; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("sup"); refChild = elementList.item(2); employeeNode = refChild.parentNode; childList = employeeNode.childNodes; newChild = doc.createElement("br"); insertedNode = employeeNode.insertBefore(newChild, refChild); for (let indexN10091 = 0; indexN10091 < childList.length; indexN10091++) { child = childList.item(indexN10091); nodeType = child.nodeType; if ( (nodeType === 1) ) { childName = child.nodeName; actual[actual.length] = childName; } } assert.deepEqual(actual, expected, "element nodeNames"); }); /** * If the "newChild" is a DocumentFragment object then all its children are inserted in the same order before the the "refChild". Create a DocumentFragment object and populate it with two Element nodes. Retrieve the second employee and insert the newly created DocumentFragment before its fourth child. The second employee should now have two extra children("newChild1" and "newChild2") at positions fourth and fifth respectively. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-952280727 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=247 */ specify("hc_nodeinsertbeforedocfragment", () => { let success; let doc; let elementList; let employeeNode; let childList; let refChild; let newdocFragment; let newChild1; let newChild2; let child; let childName; let appendedChild; let insertedNode; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("p"); employeeNode = elementList.item(1); childList = employeeNode.childNodes; refChild = childList.item(3); newdocFragment = doc.createDocumentFragment(); newChild1 = doc.createElement("br"); newChild2 = doc.createElement("b"); appendedChild = newdocFragment.appendChild(newChild1); appendedChild = newdocFragment.appendChild(newChild2); insertedNode = employeeNode.insertBefore(newdocFragment, refChild); child = childList.item(3); childName = child.nodeName; assert.equal(childName, "br", "element childName3"); child = childList.item(4); childName = child.nodeName; assert.equal(childName, "b", "element childName4"); }); /** * If the "newChild" is already in the tree, the "insertBefore(newChild,refChild)" method must first remove it before the insertion takes place. Insert a node Element ("em") that is already present in the tree. The existing node should be removed first and the new one inserted. The node is inserted at a different position in the tree to assure that it was indeed inserted. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-952280727 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=246 */ specify("hc_nodeinsertbeforenewchildexists", () => { let success; let doc; let elementList; let employeeNode; let childList; let refChild; let newChild; let child; let childName; let insertedNode; let expected = new Array(); expected[0] = "strong"; expected[1] = "code"; expected[2] = "sup"; expected[3] = "var"; expected[4] = "em"; expected[5] = "acronym"; let result = new Array(); let nodeType; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("p"); employeeNode = elementList.item(1); childList = employeeNode.getElementsByTagName("*"); refChild = childList.item(5); newChild = childList.item(0); insertedNode = employeeNode.insertBefore(newChild, refChild); for (let indexN1008C = 0; indexN1008C < childList.length; indexN1008C++) { child = childList.item(indexN1008C); nodeType = child.nodeType; if ( (nodeType === 1) ) { childName = child.nodeName; result[result.length] = childName; } } assert.deepEqual(result, expected, "element childNames"); }); /** * The "insertBefore(newChild,refChild)" method raises a HIERARCHY_REQUEST_ERR DOMException if the node to be inserted is one of this nodes ancestors. Retrieve the second employee and attempt to insert a node that is one of its ancestors(root node). An attempt to insert such a node should raise the desired exception. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='HIERARCHY_REQUEST_ERR']) * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-952280727 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-952280727')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='HIERARCHY_REQUEST_ERR']) * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-952280727 */ specify("hc_nodeinsertbeforenodeancestor", () => { let success; let doc; let newChild; let elementList; let employeeNode; let childList; let refChild; let insertedNode; doc = hc_staff.hc_staff(); newChild = doc.documentElement; elementList = doc.getElementsByTagName("p"); employeeNode = elementList.item(1); childList = employeeNode.childNodes; refChild = childList.item(0); { success = false; try { insertedNode = employeeNode.insertBefore(newChild, refChild); } catch (ex) { success = (typeof (ex.code) !== "undefined" && ex.code === 3); } assert.ok(success, "throw_HIERARCHY_REQUEST_ERR"); } }); /** * The "insertBefore(newChild,refchild)" method returns the node being inserted. Insert an Element node before the fourth child of the second employee and check the node returned from the "insertBefore(newChild,refChild)" method. The node returned should be "newChild". * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D095 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-952280727 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=247 */ specify("hc_nodeinsertbeforenodename", () => { let success; let doc; let elementList; let employeeNode; let childList; let refChild; let newChild; let insertedNode; let childName; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("p"); employeeNode = elementList.item(1); childList = employeeNode.childNodes; refChild = childList.item(3); newChild = doc.createElement("br"); insertedNode = employeeNode.insertBefore(newChild, refChild); childName = insertedNode.nodeName; assert.equal(childName, "br", "element nodeName"); }); /** * The "insertBefore(newChild,refChild)" method raises a NOT_FOUND_ERR DOMException if the reference child is not a child of this node. Retrieve the second employee and attempt to insert a new node before a reference node that is not a child of this node. An attempt to insert before a non child node should raise the desired exception. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='NOT_FOUND_ERR']) * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-952280727 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-952280727')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NOT_FOUND_ERR']) * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-952280727 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=247 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=249 */ specify("hc_nodeinsertbeforerefchildnonexistent", () => { let success; let doc; let refChild; let newChild; let elementList; let elementNode; let insertedNode; doc = hc_staff.hc_staff(); newChild = doc.createElement("br"); refChild = doc.createElement("b"); elementList = doc.getElementsByTagName("p"); elementNode = elementList.item(1); { success = false; try { insertedNode = elementNode.insertBefore(newChild, refChild); } catch (ex) { success = (typeof (ex.code) !== "undefined" && ex.code === 8); } assert.ok(success, "throw_NOT_FOUND_ERR"); } }); /** * If the "refChild" is the same as the "newChild" then don't do anything. */ specify("hc_nodeinsertbeforerefchildequal", () => { let doc = hc_staff.hc_staff(); let elementList = doc.getElementsByTagName("p"); let employeeNode = elementList.item(1); let childList = employeeNode.childNodes; let refChild = childList.item(3); employeeNode.insertBefore(refChild, refChild); }); /** * If the "refChild" is null then the "insertBefore(newChild,refChild)" method inserts the node "newChild" at the end of the list of children. Retrieve the second employee and invoke the "insertBefore(newChild,refChild)" method with refChild=null. Since "refChild" is null the "newChild" should be added to the end of the list. The last item in the list is checked after insertion. The last Element node of the list should be "newChild". * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-952280727 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=247 */ specify("hc_nodeinsertbeforerefchildnull", () => { let success; let doc; let elementList; let employeeNode; let childList; let refChild = null; let newChild; let child; let childName; let insertedNode; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("p"); employeeNode = elementList.item(1); childList = employeeNode.childNodes; newChild = doc.createElement("br"); insertedNode = employeeNode.insertBefore(newChild, refChild); child = employeeNode.lastChild; childName = child.nodeName; assert.equal(childName, "br", "element nodeName"); }); /** * Create a list of all the children elements of the third employee and access its first child by using an index of 0. This should result in the whitspace before "em" being selected (em when ignoring whitespace). Further we evaluate its content(by using the "getNodeName()" method) to ensure the proper element was accessed. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-844377136 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=246 */ specify("hc_nodelistindexequalzero", () => { let success; let doc; let elementList; let employeeNode; let employeeList; let child; let childName; let length; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("p"); employeeNode = elementList.item(2); employeeList = employeeNode.childNodes; length = employeeList.length; child = employeeList.item(0); childName = child.nodeName; if ( (length === 13) ) { assert.equal(childName, "#text", "childName_w_whitespace"); } else { assert.equal(childName, "em", "element childName_wo_whitespace"); } }); /** * The "getLength()" method returns the number of nodes in the list. Create a list of all the children elements of the third employee and invoke the "getLength()" method. It should contain the value 13. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-203510337 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=246 */ specify("hc_nodelistindexgetlength", () => { let success; let doc; let elementList; let employeeNode; let employeeList; let length; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("p"); employeeNode = elementList.item(2); employeeList = employeeNode.childNodes; length = employeeList.length; if ( (length === 6) ) { assert.equal(length, 6, "length_wo_space"); } else { assert.equal(length, 13, "length_w_space"); } }); /** * The "getLength()" method returns the number of nodes in the list.(Test for EMPTY list) Create a list of all the children of the Text node inside the first child of the third employee and invoke the "getLength()" method. It should contain the value 0. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-203510337 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=246 */ specify("hc_nodelistindexgetlengthofemptylist", () => { let success; let doc; let emList; let emNode; let textNode; let textList; let length; doc = hc_staff.hc_staff(); emList = doc.getElementsByTagName("em"); emNode = emList.item(2); textNode = emNode.firstChild; textList = textNode.childNodes; length = textList.length; assert.equal(length, 0, "length"); }); /** * The items in the list are accessible via an integral index starting from zero. (Index not equal 0) Create a list of all the children elements of the third employee and access its fourth child by using an index of 3 and calling getNodeName() which should return "strong" (no whitespace) or "#text" (with whitespace). * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-844377136 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=246 */ specify("hc_nodelistindexnotzero", () => { let success; let doc; let elementList; let employeeNode; let employeeList; let child; let childName; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("p"); employeeNode = elementList.item(2); employeeList = employeeNode.childNodes; child = employeeList.item(3); childName = child.nodeName; if ( (childName === "#text") ) { assert.equal(childName, "#text", "childName_space"); } else { assert.equal(childName, "strong", "element childName_strong"); } }); /** * Create a list of all the children elements of the third employee and access its first child by invoking the "item(index)" method with an index=0. This should result in node with a nodeName of "#text" or "em". * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-844377136 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=246 */ specify("hc_nodelistreturnfirstitem", () => { let success; let doc; let elementList; let employeeNode; let employeeList; let child; let childName; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("p"); employeeNode = elementList.item(2); employeeList = employeeNode.childNodes; child = employeeList.item(0); childName = child.nodeName; if ( (childName === "#text") ) { assert.equal(childName, "#text", "nodeName_w_space"); } else { assert.equal(childName, "em", "element nodeName_wo_space"); } }); /** * Create a list of all the children elements of the third employee and access its last child by invoking the "item(index)" method with an index=length-1. This should result in node with nodeName="#text" or acronym. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-844377136 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=246 */ specify("hc_nodelistreturnlastitem", () => { let success; let doc; let elementList; let employeeNode; let employeeList; let child; let childName; let index; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("p"); employeeNode = elementList.item(2); employeeList = employeeNode.childNodes; index = employeeList.length; index -= 1; child = employeeList.item(index); childName = child.nodeName; if ( (index === 12) ) { assert.equal(childName, "#text", "lastNodeName_w_whitespace"); } else { assert.equal(childName, "acronym", "element lastNodeName"); assert.equal(index, 5, "index"); } }); /** * The range of valid child node indices is 0 thru length -1 Create a list of all the children elements of the third employee and traverse the list from index=0 thru length -1. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-203510337 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-844377136 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=246 */ specify("hc_nodelisttraverselist", () => { let success; let doc; let elementList; let employeeNode; let employeeList; let child; let childName; let nodeType; let result = new Array(); let expected = new Array(); expected[0] = "em"; expected[1] = "strong"; expected[2] = "code"; expected[3] = "sup"; expected[4] = "var"; expected[5] = "acronym"; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("p"); employeeNode = elementList.item(2); employeeList = employeeNode.childNodes; for (let indexN10073 = 0; indexN10073 < employeeList.length; indexN10073++) { child = employeeList.item(indexN10073); nodeType = child.nodeType; childName = child.nodeName; if ( (nodeType === 1) ) { result[result.length] = childName; } else { assert.equal(nodeType, 3, "textNodeType"); assert.equal(childName, "#text", "textNodeName"); } } assert.deepEqual(result, expected, "element nodeNames"); }); /** * The "getParentNode()" method returns the parent of this node. Retrieve the second employee and invoke the "getParentNode()" method on this node. It should be set to "body". * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1060184317 */ specify("hc_nodeparentnode", () => { let success; let doc; let elementList; let employeeNode; let parentNode; let parentName; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("p"); employeeNode = elementList.item(1); parentNode = employeeNode.parentNode; parentName = parentNode.nodeName; assert.equal(parentName, "body", "element parentNodeName"); }); /** * The "getParentNode()" method invoked on a node that has just been created and not yet added to the tree is null. Create a new "employee" Element node using the "createElement(name)" method from the Document interface. Since this new node has not yet been added to the tree, the "getParentNode()" method will return null. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1060184317 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=247 */ specify("hc_nodeparentnodenull", () => { let success; let doc; let createdNode; let parentNode; doc = hc_staff.hc_staff(); createdNode = doc.createElement("br"); parentNode = createdNode.parentNode; assert.equal(parentNode, null, "parentNode"); }); /** * The "removeChild(oldChild)" method removes the child node indicated by "oldChild" from the list of children and returns it. Remove the first employee by invoking the "removeChild(oldChild)" method an checking the node returned by the "getParentNode()" method. It should be set to null. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1734834066 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=249 */ specify("hc_noderemovechild", () => { let success; let doc; let rootNode; let childList; let childToRemove; let removedChild; let parentNode; doc = hc_staff.hc_staff(); rootNode = doc.documentElement; childList = rootNode.childNodes; childToRemove = childList.item(1); removedChild = rootNode.removeChild(childToRemove); parentNode = removedChild.parentNode; assert.equal(parentNode, null, "parentNodeNull"); }); /** * The "removeChild(oldChild)" method returns the node being removed. Remove the first child of the second employee and check the NodeName returned by the "removeChild(oldChild)" method. The returned node should have a NodeName equal to "#text". * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D095 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1734834066 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=246 */ specify("hc_noderemovechildgetnodename", () => { let success; let doc; let elementList; let employeeNode; let childList; let oldChild; let removedChild; let childName; let oldName; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("p"); employeeNode = elementList.item(1); childList = employeeNode.childNodes; oldChild = childList.item(0); oldName = oldChild.nodeName; removedChild = employeeNode.removeChild(oldChild); assert.notEqual(removedChild, null, "notnull"); childName = removedChild.nodeName; assert.equal(childName, oldName, "nodeName"); }); /** * The "removeChild(oldChild)" method removes the node indicated by "oldChild". Retrieve the second p element and remove its first child. After the removal, the second p element should have 5 element children and the first child should now be the child that used to be at the second position in the list. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1734834066 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=246 */ specify("hc_noderemovechildnode", () => { let success; let doc; let elementList; let emList; let employeeNode; let childList; let oldChild; let child; let childName; let length; let removedChild; let removedName; let nodeType; let expected = new Array(); expected[0] = "strong"; expected[1] = "code"; expected[2] = "sup"; expected[3] = "var"; expected[4] = "acronym"; let actual = new Array(); doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("p"); employeeNode = elementList.item(1); childList = employeeNode.childNodes; emList = employeeNode.getElementsByTagName("em"); oldChild = emList.item(0); removedChild = employeeNode.removeChild(oldChild); removedName = removedChild.nodeName; assert.equal(removedName, "em", "element removedName"); for (let indexN10098 = 0; indexN10098 < childList.length; indexN10098++) { child = childList.item(indexN10098); nodeType = child.nodeType; childName = child.nodeName; if ( (nodeType === 1) ) { actual[actual.length] = childName; } else { assert.equal(nodeType, 3, "textNodeType"); assert.equal(childName, "#text", "textNodeName"); } } assert.deepEqual(actual, expected, "element childNames"); }); /** * The "removeChild(oldChild)" method raises a NOT_FOUND_ERR DOMException if the old child is not a child of this node. Retrieve the second employee and attempt to remove a node that is not one of its children. An attempt to remove such a node should raise the desired exception. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='NOT_FOUND_ERR']) * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1734834066 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-1734834066')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NOT_FOUND_ERR']) * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1734834066 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=247 */ specify("hc_noderemovechildoldchildnonexistent", () => { let success; let doc; let oldChild; let elementList; let elementNode; let removedChild; doc = hc_staff.hc_staff(); oldChild = doc.createElement("br"); elementList = doc.getElementsByTagName("p"); elementNode = elementList.item(1); { success = false; try { removedChild = elementNode.removeChild(oldChild); } catch (ex) { success = (typeof (ex.code) !== "undefined" && ex.code === 8); } assert.ok(success, "throw_NOT_FOUND_ERR"); } }); /** * The "replaceChild(newChild,oldChild)" method replaces the node "oldChild" with the node "newChild". Replace the first element of the second employee with a newly created Element node. Check the first position after the replacement operation is completed. The new Element should be "newChild". * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-785887307 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=247 */ specify("hc_nodereplacechild", () => { let success; let doc; let elementList; let employeeNode; let childList; let oldChild; let newChild; let child; let childName; let replacedNode; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("p"); employeeNode = elementList.item(1); childList = employeeNode.childNodes; oldChild = childList.item(0); newChild = doc.createElement("br"); replacedNode = employeeNode.replaceChild(newChild, oldChild); child = childList.item(0); childName = child.nodeName; assert.equal(childName, "br", "element nodeName"); }); /** * If the "newChild" is already in the tree, it is first removed before the new one is added. Retrieve the second "p" and replace "acronym" with its "em". * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-785887307 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=246 */ specify("hc_nodereplacechildnewchildexists", () => { let success; let doc; let elementList; let employeeNode; let childList; let oldChild = null; let newChild = null; let child; let childName; let childNode; let actual = new Array(); let expected = new Array(); expected[0] = "strong"; expected[1] = "code"; expected[2] = "sup"; expected[3] = "var"; expected[4] = "em"; let replacedChild; let nodeType; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("p"); employeeNode = elementList.item(1); childList = employeeNode.getElementsByTagName("*"); newChild = childList.item(0); oldChild = childList.item(5); replacedChild = employeeNode.replaceChild(newChild, oldChild); assert.equal(replacedChild, oldChild, "return_value_same"); for (let indexN10094 = 0; indexN10094 < childList.length; indexN10094++) { childNode = childList.item(indexN10094); childName = childNode.nodeName; nodeType = childNode.nodeType; if ( (nodeType === 1) ) { actual[actual.length] = childName; } else { assert.equal(nodeType, 3, "textNodeType"); assert.equal(childName, "#text", "textNodeName"); } } assert.deepEqual(actual, expected, "element childNames"); }); /** * The "replaceChild(newChild,oldChild)" method raises a HIERARCHY_REQUEST_ERR DOMException if the node to put in is one of this node's ancestors. Retrieve the second employee and attempt to replace one of its children with an ancestor node(root node). An attempt to make such a replacement should raise the desired exception. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='HIERARCHY_REQUEST_ERR']) * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-785887307 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-785887307')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='HIERARCHY_REQUEST_ERR']) * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-785887307 */ specify("hc_nodereplacechildnodeancestor", () => { let success; let doc; let newChild; let elementList; let employeeNode; let childList; let oldChild; let replacedNode; doc = hc_staff.hc_staff(); newChild = doc.documentElement; elementList = doc.getElementsByTagName("p"); employeeNode = elementList.item(1); childList = employeeNode.childNodes; oldChild = childList.item(0); { success = false; try { replacedNode = employeeNode.replaceChild(newChild, oldChild); } catch (ex) { success = (typeof (ex.code) !== "undefined" && ex.code === 3); } assert.ok(success, "throw_HIERARCHY_REQUEST_ERR"); } }); /** * The "replaceChild(newChild,oldChild)" method returns the node being replaced. Replace the second Element of the second employee with a newly created node Element and check the NodeName returned by the "replaceChild(newChild,oldChild)" method. The returned node should have a NodeName equal to "em". * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D095 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-785887307 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=247 */ specify("hc_nodereplacechildnodename", () => { let success; let doc; let elementList; let employeeNode; let childList; let oldChild; let newChild; let replacedNode; let childName; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("p"); employeeNode = elementList.item(1); childList = employeeNode.getElementsByTagName("em"); oldChild = childList.item(0); newChild = doc.createElement("br"); replacedNode = employeeNode.replaceChild(newChild, oldChild); childName = replacedNode.nodeName; assert.equal(childName, "em", "element replacedNodeName"); }); /** * The "replaceChild(newChild,oldChild)" method raises a NOT_FOUND_ERR DOMException if the old child is not a child of this node. Retrieve the second employee and attempt to replace a node that is not one of its children. An attempt to replace such a node should raise the desired exception. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='NOT_FOUND_ERR']) * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-785887307 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-785887307')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NOT_FOUND_ERR']) * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-785887307 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=247 */ specify("hc_nodereplacechildoldchildnonexistent", () => { let success; let doc; let oldChild; let newChild; let elementList; let elementNode; let replacedNode; doc = hc_staff.hc_staff(); newChild = doc.createElement("br"); oldChild = doc.createElement("b"); elementList = doc.getElementsByTagName("p"); elementNode = elementList.item(1); { success = false; try { replacedNode = elementNode.replaceChild(newChild, oldChild); } catch (ex) { success = (typeof (ex.code) !== "undefined" && ex.code === 8); } assert.ok(success, "throw_NOT_FOUND_ERR"); } }); /** * The "getAttributes()" method invoked on a Text Node returns null. Retrieve the Text node from the last child of the first employee and invoke the "getAttributes()" method on the Text Node. It should return null. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-84CF096 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1312295772 */ specify("hc_nodetextnodeattribute", () => { let success; let doc; let elementList; let testAddr; let textNode; let attrList; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("acronym"); testAddr = elementList.item(0); textNode = testAddr.firstChild; attrList = textNode.attributes; assert.equal(attrList, null, "text_attributes_is_null"); }); /** * The string returned by the "getNodeName()" method for a Text Node is "#text". * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D095 */ specify("hc_nodetextnodename", () => { let success; let doc; let elementList; let testAddr; let textNode; let textName; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("acronym"); testAddr = elementList.item(0); textNode = testAddr.firstChild; textName = textNode.nodeName; assert.equal(textName, "#text", "textNodeName"); }); /** * The "getNodeType()" method for a Text Node returns the constant value 3. Retrieve the Text node from the last child of the first employee and invoke the "getNodeType()" method. The method should return 3. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-111237558 */ specify("hc_nodetextnodetype", () => { let success; let doc; let elementList; let testAddr; let textNode; let nodeType; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("acronym"); testAddr = elementList.item(0); textNode = testAddr.firstChild; nodeType = textNode.nodeType; assert.equal(nodeType, 3, "nodeTextNodeTypeAssert1"); }); /** * The string returned by the "getNodeValue()" method for a Text Node is the content of the Text node. Retrieve the Text node from the last child of the first employee and check the string returned by the "getNodeValue()" method. It should be equal to "1230 North Ave. Dallas, Texas 98551". * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D080 */ specify("hc_nodetextnodevalue", () => { let success; let doc; let elementList; let testAddr; let textNode; let textValue; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("acronym"); testAddr = elementList.item(0); textNode = testAddr.firstChild; textValue = textNode.nodeValue; assert.equal(textValue, "1230 North Ave. Dallas, Texas 98551", "textNodeValue"); }); /** * An element is created, setNodeValue is called with a non-null argument, but getNodeValue should still return null. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D080 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#i-Document */ specify("hc_nodevalue01", () => { let success; let doc; let newNode; let newValue; doc = hc_staff.hc_staff(); newNode = doc.createElement("acronym"); newValue = newNode.nodeValue; assert.equal(newValue, null, "initiallyNull"); newNode.nodeValue = "This should have no effect"; newValue = newNode.nodeValue; assert.equal(newValue, null, "nullAfterAttemptedChange"); }); /** * An comment is created, setNodeValue is called with a non-null argument, but getNodeValue should still return null. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D080 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1728279322 */ specify("hc_nodevalue02", () => { let success; let doc; let newNode; let newValue; doc = hc_staff.hc_staff(); newNode = doc.createComment("This is a new Comment node"); newValue = newNode.nodeValue; assert.equal(newValue, "This is a new Comment node", "initial"); newNode.nodeValue = "This should have an effect"; newValue = newNode.nodeValue; assert.equal(newValue, "This should have an effect", "afterChange"); }); /** * An document type accessed, setNodeValue is called with a non-null argument, but getNodeValue should still return null. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D080 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-B63ED1A31 */ specify("hc_nodevalue04", () => { let success; let doc; let newNode; let newValue; doc = hc_staff.hc_staff(); newNode = doc.doctype; assert.notEqual(newNode, null, "docTypeNotNull"); newValue = newNode.nodeValue; assert.equal(newValue, null, "initiallyNull"); newNode.nodeValue = "This should have no effect"; newValue = newNode.nodeValue; assert.equal(newValue, null, "nullAfterAttemptedChange"); }); /** * A document fragment is created, setNodeValue is called with a non-null argument, but getNodeValue should still return null. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D080 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-B63ED1A3 */ specify("hc_nodevalue05", () => { let success; let doc; let newNode; let newValue; doc = hc_staff.hc_staff(); newNode = doc.createDocumentFragment(); newValue = newNode.nodeValue; assert.equal(newValue, null, "initiallyNull"); newNode.nodeValue = "This should have no effect"; newValue = newNode.nodeValue; assert.equal(newValue, null, "nullAfterAttemptedChange"); }); /** * An document is accessed, setNodeValue is called with a non-null argument, but getNodeValue should still return null. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D080 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#i-Document */ specify("hc_nodevalue06", () => { let success; let newNode; let newValue; newNode = hc_staff.hc_staff(); newValue = newNode.nodeValue; assert.equal(newValue, null, "initiallyNull"); newNode.nodeValue = "This should have no effect"; newValue = newNode.nodeValue; assert.equal(newValue, null, "nullAfterAttemptedChange"); }); /** * The "splitText(offset)" method raises an INDEX_SIZE_ERR DOMException if the specified offset is negative. Retrieve the textual data from the second child of the third employee and invoke the "splitText(offset)" method. The desired exception should be raised since the offset is a negative number. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INDEX_SIZE_ERR']) * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-38853C1D * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-38853C1D')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INDEX_SIZE_ERR']) */ specify("hc_textindexsizeerrnegativeoffset", () => { let success; let doc; let elementList; let nameNode; let textNode; let splitNode; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("strong"); nameNode = elementList.item(2); textNode = nameNode.firstChild; { success = false; try { splitNode = textNode.splitText(-69); } catch (ex) { success = (typeof (ex.code) !== "undefined" && ex.code === 1); } assert.ok(success, "throws_INDEX_SIZE_ERR"); } }); /** * The "splitText(offset)" method raises an INDEX_SIZE_ERR DOMException if the specified offset is greater than the number of characters in the Text node. Retrieve the textual data from the second child of the third employee and invoke the "splitText(offset)" method. The desired exception should be raised since the offset is a greater than the number of characters in the Text node. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INDEX_SIZE_ERR']) * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-38853C1D * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-38853C1D')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INDEX_SIZE_ERR']) * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=249 */ specify("hc_textindexsizeerroffsetoutofbounds", () => { let success; let doc; let elementList; let nameNode; let textNode; let splitNode; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("strong"); nameNode = elementList.item(2); textNode = nameNode.firstChild; { success = false; try { splitNode = textNode.splitText(300); } catch (ex) { success = (typeof (ex.code) !== "undefined" && ex.code === 1); } assert.ok(success, "throw_INDEX_SIZE_ERR"); } }); /** * The "splitText(offset)" method returns the new Text node. Retrieve the textual data from the last child of the first employee and invoke the "splitText(offset)" method. The method should return the new Text node. The offset value used for this test is 30. The "getNodeValue()" method is called to check that the new node now contains the characters at and after position 30. (Starting count at 0) * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-38853C1D */ specify("hc_textsplittextfour", () => { let success; let doc; let elementList; let addressNode; let textNode; let splitNode; let value; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("acronym"); addressNode = elementList.item(0); textNode = addressNode.firstChild; splitNode = textNode.splitText(30); value = splitNode.nodeValue; assert.equal(value, "98551", "textSplitTextFourAssert"); }); /** * The "splitText(offset)" method breaks the Text node into two Text nodes at the specified offset keeping each node as siblings in the tree. Retrieve the textual data from the second child of the third employee and invoke the "splitText(offset)" method. The method splits the Text node into two new sibling Text nodes keeping both of them in the tree. This test checks the "nextSibling()" method of the original node to ensure that the two nodes are indeed siblings. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-38853C1D */ specify("hc_textsplittextone", () => { let success; let doc; let elementList; let nameNode; let textNode; let splitNode; let secondPart; let value; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("strong"); nameNode = elementList.item(2); textNode = nameNode.firstChild; splitNode = textNode.splitText(7); secondPart = textNode.nextSibling; value = secondPart.nodeValue; assert.equal(value, "Jones", "textSplitTextOneAssert"); }); /** * After the "splitText(offset)" method breaks the Text node into two Text nodes, the new Text node contains all the content at and after the offset point. Retrieve the textual data from the second child of the third employee and invoke the "splitText(offset)" method. The new Text node should contain all the content at and after the offset point. The "getNodeValue()" method is called to check that the new node now contains the characters at and after position seven. (Starting count at 0) * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-38853C1D */ specify("hc_textsplittextthree", () => { let success; let doc; let elementList; let nameNode; let textNode; let splitNode; let value; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("strong"); nameNode = elementList.item(2); textNode = nameNode.firstChild; splitNode = textNode.splitText(6); value = splitNode.nodeValue; assert.equal(value, " Jones", "textSplitTextThreeAssert"); }); /** * After the "splitText(offset)" method breaks the Text node into two Text nodes, the original node contains all the content up to the offset point. Retrieve the textual data from the second child of the third employee and invoke the "splitText(offset)" method. The original Text node should contain all the content up to the offset point. The "getNodeValue()" method is called to check that the original node now contains the first five characters. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-38853C1D */ specify("hc_textsplittexttwo", () => { let success; let doc; let elementList; let nameNode; let textNode; let splitNode; let value; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("strong"); nameNode = elementList.item(2); textNode = nameNode.firstChild; splitNode = textNode.splitText(5); value = textNode.nodeValue; assert.equal(value, "Roger", "textSplitTextTwoAssert"); }); /** * If there is not any markup inside an Element or Attr node content, then the text is contained in a single object implementing the Text interface that is the only child of the element. Retrieve the textual data from the second child of the third employee. That Text node contains a block of multiple text lines without markup, so they should be treated as a single Text node. The "getNodeValue()" method should contain the combination of the two lines. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1312295772 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D080 */ specify("hc_textwithnomarkup", () => { let success; let doc; let elementList; let nameNode; let nodeV; let value; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("strong"); nameNode = elementList.item(2); nodeV = nameNode.firstChild; value = nodeV.nodeValue; assert.equal(value, "Roger\n Jones", "textWithNoMarkupAssert"); }); /** * The range of valid child node indices is 0 to Length -1. Create a NamedNodeMap object from the attributes of the last child of the third employee and traverse the list from index 0 thru length -1. All indices should be valid. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-84CF096 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-349467F9 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-6D0FB19E */ specify("namednodemapchildnoderange", () => { let success; let doc; let elementList; let testEmployee; let attributes; let child; let length; doc = staff.staff(); elementList = doc.getElementsByTagName("address"); testEmployee = elementList.item(2); attributes = testEmployee.attributes; length = attributes.length; assert.equal(length, 2, "length"); child = attributes.item(0); child = attributes.item(1); }); /** * The "getNamedItem(name)" method retrieves a node specified by name. Retrieve the second employee and create a NamedNodeMap listing of the attributes of the last child. Once the list is created an invocation of the "getNamedItem(name)" method is done with name="domestic". This should result in the domestic Attr node being returned. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1074577549 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-349467F9 */ specify("namednodemapgetnameditem", () => { let success; let doc; let elementList; let testEmployee; let attributes; let domesticAttr; let attrName; doc = staff.staff(); elementList = doc.getElementsByTagName("address"); testEmployee = elementList.item(1); attributes = testEmployee.attributes; domesticAttr = attributes.getNamedItem("domestic"); attrName = domesticAttr.name; assert.equal(attrName, "domestic", "namednodemapGetNamedItemAssert"); }); /** * The "setNamedItem(arg)" method raises a INUSE_ATTRIBUTE_ERR DOMException if "arg" is an Attr that is already in an attribute of another Element. Create a NamedNodeMap object from the attributes of the last child of the third employee and attempt to add an attribute that is already being used by the first employee. This should raise the desired exception. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INUSE_ATTRIBUTE_ERR']) * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1025163788 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-1025163788')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INUSE_ATTRIBUTE_ERR']) * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=249 */ specify("namednodemapinuseattributeerr", () => { let success; let doc; let elementList; let firstNode; let testNode; let attributes; let domesticAttr; let setAttr; let setNode; doc = staff.staff(); elementList = doc.getElementsByTagName("address"); firstNode = elementList.item(0); domesticAttr = doc.createAttribute("domestic"); domesticAttr.value = "Yes"; setAttr = firstNode.setAttributeNode(domesticAttr); elementList = doc.getElementsByTagName("address"); testNode = elementList.item(2); attributes = testNode.attributes; { success = false; try { setNode = attributes.setNamedItem(domesticAttr); } catch (ex) { success = (typeof (ex.code) !== "undefined" && ex.code === 10); } assert.ok(success, "throw_INUSE_ATTRIBUTE_ERR"); } }); /** * The "removeNamedItem(name)" method raises a NOT_FOUND_ERR DOMException if there is not a node named "name" in the map. Create a NamedNodeMap object from the attributes of the last child of the third employee and attempt to remove the "district" attribute. There is not a node named "district" in the list and therefore the desired exception should be raised. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INUSE_ATTRIBUTE_ERR']) * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-D58B193 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-D58B193')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INUSE_ATTRIBUTE_ERR']) */ specify("namednodemapnotfounderr", () => { let success; let doc; let elementList; let testEmployee; let attributes; let removedNode; doc = staff.staff(); elementList = doc.getElementsByTagName("address"); testEmployee = elementList.item(2); attributes = testEmployee.attributes; { success = false; try { removedNode = attributes.removeNamedItem("district"); } catch (ex) { success = (typeof (ex.code) !== "undefined" && ex.code === 8); } assert.ok(success, "throw_NOT_FOUND_ERR"); } }); /** * The "getLength()" method returns the number of nodes in the map. Retrieve the second employee and create a NamedNodeMap listing of the attributes of the last child. Once the list is created an invocation of the "getLength()" method is executed. The number of nodes should be 2. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-84CF096 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-6D0FB19E */ specify("namednodemapnumberofnodes", () => { let success; let doc; let elementList; let testEmployee; let attributes; let length; doc = staff.staff(); elementList = doc.getElementsByTagName("address"); testEmployee = elementList.item(2); attributes = testEmployee.attributes; length = attributes.length; assert.equal(length, 2, "length"); }); /** * The "removeNamedItem(name)" method returns the node removed from the map. Retrieve the third employee and create a NamedNodeMap object of the attributes of the last child. Once the list is created invoke the "removeNamedItem(name)" method with name="street". The "removeNamedItem(name)" method should remove the existing "street" attribute and return it. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-D58B193 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-349467F9 */ specify("namednodemapremovenameditemreturnnodevalue", () => { let success; let doc; let elementList; let testAddress; let attributes; let removedNode; let value; doc = staff.staff(); elementList = doc.getElementsByTagName("address"); testAddress = elementList.item(2); attributes = testAddress.attributes; removedNode = attributes.removeNamedItem("street"); value = removedNode.nodeValue; assert.equal(value, "No", "namednodemapRemoveNamedItemReturnNodeValueAssert"); }); /** * The "getNamedItem(name)" method returns a node of any type specified by name. Retrieve the second employee and create a NamedNodeMap listing of the attributes of the last child. Once the list is created an invocation of the "getNamedItem(name)" method is done with name="street". This should result in the method returning an Attr node. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1074577549 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-84CF096 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-637646024 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1112119403 */ specify("namednodemapreturnattrnode", () => { let success; let doc; let elementList; let testEmployee; let attributes; let streetAttr; let attrName; doc = staff.staff(); elementList = doc.getElementsByTagName("address"); testEmployee = elementList.item(1); attributes = testEmployee.attributes; streetAttr = attributes.getNamedItem("street"); attrName = streetAttr.name; assert.equal(attrName, "street", "nodeName"); attrName = streetAttr.name; assert.equal(attrName, "street", "attrName"); }); /** * Correct value for first attribute of second employee */ specify("namednodemapreturnfirstitem", () => { let doc = staff.staff(); let child = doc.getElementsByTagName("address").item(1).attributes.item(0); assert.equal(child.name, "domestic"); }); /** * * Correct value for second attribute of second employee */ specify("namednodemapreturnlastitem", () => { let doc = staff.staff(); let child = doc.getElementsByTagName("address").item(1).attributes.item(1); assert.equal(child.name, "street"); }); /** * The "getNamedItem(name)" method returns null of the specified name did not identify any node in the map. Retrieve the second employee and create a NamedNodeMap listing of the attributes of the last child. Once the list is created an invocation of the "getNamedItem(name)" method is done with name="district". This name does not match any names in the list therefore the method should return null. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1074577549 */ specify("namednodemapreturnnull", () => { let success; let doc; let elementList; let testEmployee; let attributes; let districtNode; doc = staff.staff(); elementList = doc.getElementsByTagName("address"); testEmployee = elementList.item(1); attributes = testEmployee.attributes; districtNode = attributes.getNamedItem("district"); assert.equal(districtNode, null, "namednodemapReturnNullAssert"); }); /** * The "setNamedItem(arg)" method adds a node using its nodeName attribute. Retrieve the second employee and create a NamedNodeMap object from the attributes of the last child by invoking the "getAttributes()" method. Once the list is created an invocation of the "setNamedItem(arg)" method is done with arg=newAttr, where newAttr is a new Attr Node previously created. The "setNamedItem(arg)" method should add then new node to the NamedNodeItem object by using its "nodeName" attribute("district'). This node is then retrieved using the "getNamedItem(name)" method. This test uses the "createAttribute(name)" method from the document interface. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1025163788 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-349467F9 */ specify("namednodemapsetnameditem", () => { let success; let doc; let elementList; let newAttribute; let testAddress; let attributes; let districtNode; let attrName; let setNode; doc = staff.staff(); elementList = doc.getElementsByTagName("address"); testAddress = elementList.item(1); newAttribute = doc.createAttribute("district"); attributes = testAddress.attributes; setNode = attributes.setNamedItem(newAttribute); districtNode = attributes.getNamedItem("district"); attrName = districtNode.name; assert.equal(attrName, "district", "namednodemapSetNamedItemAssert"); }); /** * If the "setNamedItem(arg)" method replaces an already existing node with the same name then the already existing node is returned. Retrieve the third employee and create a NamedNodeMap object from the attributes of the last child by invoking the "getAttributes()" method. Once the list is created an invocation of the "setNamedItem(arg)" method is done with arg=newAttr, where newAttr is a new Attr Node previously created and whose node name already exists in the map. The "setNamedItem(arg)" method should replace the already existing node with the new one and return the existing node. This test uses the "createAttribute(name)" method from the document interface. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1025163788 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-349467F9 */ specify("namednodemapsetnameditemreturnvalue", () => { let success; let doc; let elementList; let newAttribute; let testAddress; let attributes; let newNode; let attrValue; doc = staff.staff(); elementList = doc.getElementsByTagName("address"); testAddress = elementList.item(2); newAttribute = doc.createAttribute("street"); attributes = testAddress.attributes; newNode = attributes.setNamedItem(newAttribute); attrValue = newNode.nodeValue; assert.equal(attrValue, "No", "returnedNodeValue"); }); /** * If the node to be added by the "setNamedItem(arg)" method already exists in the NamedNodeMap, it is replaced by the new one. Retrieve the second employee and create a NamedNodeMap object from the attributes of the last child by invoking the "getAttributes()" method. Once the list is created an invocation of the "setNamedItem(arg)" method is done with arg=newAttr, where newAttr is a new Attr Node previously created and whose node name already exists in the map. The "setNamedItem(arg)" method should replace the already existing node with the new one. This node is then retrieved using the "getNamedItem(name)" method. This test uses the "createAttribute(name)" method from the document interface * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1025163788 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-349467F9 */ specify("namednodemapsetnameditemthatexists", () => { let success; let doc; let elementList; let newAttribute; let testAddress; let attributes; let districtNode; let attrValue; let setNode; doc = staff.staff(); elementList = doc.getElementsByTagName("address"); testAddress = elementList.item(1); newAttribute = doc.createAttribute("street"); attributes = testAddress.attributes; setNode = attributes.setNamedItem(newAttribute); districtNode = attributes.getNamedItem("street"); attrValue = districtNode.nodeValue; assert.equal(attrValue, "", "streetValue"); }); /** * If the "setNamedItem(arg)" method does not replace an existing node with the same name then it returns null. Retrieve the third employee and create a NamedNodeMap object from the attributes of the last child. Once the list is created the "setNamedItem(arg)" method is invoked with arg=newAttr, where newAttr is a newly created Attr Node and whose node name already exists in the map. The "setNamedItem(arg)" method should add the new node and return null. This test uses the "createAttribute(name)" method from the document interface. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1025163788 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-349467F9 */ specify("namednodemapsetnameditemwithnewvalue", () => { let success; let doc; let elementList; let newAttribute; let testAddress; let attributes; let newNode; doc = staff.staff(); elementList = doc.getElementsByTagName("address"); testAddress = elementList.item(2); newAttribute = doc.createAttribute("district"); attributes = testAddress.attributes; newNode = attributes.setNamedItem(newAttribute); assert.equal(newNode, null, "returnedNodeNull"); }); /** * The "appendChild(newChild)" method adds the node "newChild" to the end of the list of children of the node. Retrieve the second employee and append a new Element node to the list of children. The last node in the list is then retrieved and its NodeName examined. The "getNodeName()" method should return "newChild". * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-184E7107 */ specify("nodeappendchild", () => { let success; let doc; let elementList; let employeeNode; let childList; let createdNode; let lchild; let childName; let appendedChild; doc = staff.staff(); elementList = doc.getElementsByTagName("employee"); employeeNode = elementList.item(1); childList = employeeNode.childNodes; createdNode = doc.createElement("newChild"); appendedChild = employeeNode.appendChild(createdNode); lchild = employeeNode.lastChild; childName = lchild.nodeName; assert.equal(childName, "newChild", "nodeAppendChildAssert1"); }); /** * If the "newChild" is already in the tree, it is first removed before the new one is appended. Retrieve the first child of the second employee and append the first child to the end of the list. After the "appendChild(newChild)" method is invoked the first child should be the one that was second and the last child should be the one that was first. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-184E7107 */ specify("nodeappendchildchildexists", () => { let success; let doc; let elementList; let childNode; let newChild; let lchild; let fchild; let lchildName; let fchildName; let appendedChild; let initialName; doc = staff.staff(); elementList = doc.getElementsByTagName("employee"); childNode = elementList.item(1); newChild = childNode.firstChild; initialName = newChild.nodeName; appendedChild = childNode.appendChild(newChild); fchild = childNode.firstChild; fchildName = fchild.nodeName; lchild = childNode.lastChild; lchildName = lchild.nodeName; if ( (initialName === "employeeId") ) { assert.equal(fchildName, "name", "assert1_nowhitespace"); assert.equal(lchildName, "employeeId", "assert2_nowhitespace"); } else { assert.equal(fchildName, "employeeId", "assert1"); assert.equal(lchildName, "#text", "assert2"); } }); /** * Create and populate a new DocumentFragment object and append it to the second employee. After the "appendChild(newChild)" method is invoked retrieve the new nodes at the end of the list, they should be the three (Jos: was two) Element nodes from the DocumentFragment. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-184E7107 * MODIFIED BY Jos Shepherd - added a third new child */ specify("nodeappendchilddocfragment", () => { let success; let doc; let elementList; let employeeNode; let childList; let newdocFragment; let newChild1; let newChild2; let newChild3; let child; let childName; let result = new Array(); let nodeType; let appendedChild; let expected = new Array(); expected[0] = "employeeId"; expected[1] = "name"; expected[2] = "position"; expected[3] = "salary"; expected[4] = "gender"; expected[5] = "address"; expected[6] = "newChild1"; expected[7] = "newChild2"; expected[8] = "newChild3"; doc = staff.staff(); elementList = doc.getElementsByTagName("employee"); employeeNode = elementList.item(1); childList = employeeNode.childNodes; newdocFragment = doc.createDocumentFragment(); newChild1 = doc.createElement("newChild1"); newChild2 = doc.createElement("newChild2"); newChild3 = doc.createElement("newChild3"); appendedChild = newdocFragment.appendChild(newChild1); appendedChild = newdocFragment.appendChild(newChild2); appendedChild = newdocFragment.appendChild(newChild3); appendedChild = employeeNode.appendChild(newdocFragment); for (let indexN1009F = 0; indexN1009F < childList.length; indexN1009F++) { child = childList.item(indexN1009F); nodeType = child.nodeType; if ( (nodeType === 1) ) { childName = child.nodeName; result[result.length] = childName; } } assert.deepEqual(result, expected, "elementNames"); }); /** * The "appendChild(newChild)" method returns the node added. Append a newly created node to the child list of the second employee and check the NodeName returned. The "getNodeName()" method should return "newChild". * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D095 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-184E7107 */ specify("nodeappendchildgetnodename", () => { let success; let doc; let elementList; let employeeNode; let childList; let newChild; let appendNode; let childName; doc = staff.staff(); elementList = doc.getElementsByTagName("employee"); employeeNode = elementList.item(1); childList = employeeNode.childNodes; newChild = doc.createElement("newChild"); appendNode = employeeNode.appendChild(newChild); childName = appendNode.nodeName; assert.equal(childName, "newChild", "nodeAppendChildGetNodeNameAssert1"); }); /** * The "appendChild(newChild)" method raises a HIERARCHY_REQUEST_ERR DOMException if the node to append is one of this node's ancestors. Retrieve the second employee and attempt to append an ancestor node(root node) to it. An attempt to make such an addition should raise the desired exception. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='HIERARCHY_REQUEST_ERR']) * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-184E7107 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-184E7107')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='HIERARCHY_REQUEST_ERR']) * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-184E7107 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=249 */ specify("nodeappendchildnodeancestor", () => { let success; let doc; let newChild; let elementList; let employeeNode; let appendedChild; doc = staff.staff(); newChild = doc.documentElement; elementList = doc.getElementsByTagName("employee"); employeeNode = elementList.item(1); { success = false; try { appendedChild = employeeNode.appendChild(newChild); } catch (ex) { success = (typeof (ex.code) !== "undefined" && ex.code === 3); } assert.ok(success, "throw_HIERARCHY_REQUEST_ERR"); } }); /** * The "getAttributes()" method invoked on an Attribute Node returns null. Retrieve the first attribute from the last child of the first employee and invoke the "getAttributes()" method on the Attribute Node. It should return null. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-84CF096 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-637646024 */ specify("nodeattributenodeattribute", () => { let success; let doc; let elementList; let testAddr; let addrAttr; let attrNode; let attrList; doc = staff.staff(); elementList = doc.getElementsByTagName("address"); testAddr = elementList.item(0); addrAttr = testAddr.attributes; attrNode = addrAttr.item(0); attrList = attrNode.attributes; assert.equal(attrList, null, "nodeAttributeNodeAttributeAssert1"); }); /** * The string returned by the "getNodeName()" method for an Attribute Node is the name of the Attribute. Retrieve the Attribute named "domestic" from the last child of the first employee and check the string returned by the "getNodeName()" method. It should be equal to "domestic". * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D095 */ specify("nodeattributenodename", () => { let success; let doc; let elementList; let testAddr; let addrAttr; let attrName; doc = staff.staff(); elementList = doc.getElementsByTagName("address"); testAddr = elementList.item(0); addrAttr = testAddr.getAttributeNode("domestic"); attrName = addrAttr.name; assert.equal(attrName, "domestic", "nodeAttributeNodeNameAssert1"); }); /** * The string returned by the "getNodeValue()" method for an Attribute Node is the value of the Attribute. Retrieve the Attribute named "domestic" from the last child of the first employee and check the string returned by the "getNodeValue()" method. It should be equal to "Yes". * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D080 */ specify("nodeattributenodevalue", () => { let success; let doc; let elementList; let testAddr; let addrAttr; let attrValue; doc = staff.staff(); elementList = doc.getElementsByTagName("address"); testAddr = elementList.item(0); addrAttr = testAddr.getAttributeNode("domestic"); attrValue = addrAttr.nodeValue; assert.equal(attrValue, "Yes", "nodeAttributeNodeValueAssert1"); }); /** * Collect the element names from Node.childNodes and check against expectations. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1451460987 */ specify("nodechildnodes", () => { let success; let doc; let elementList; let employeeNode; let childNodes; let childNode; let childType; let childName; let elementNames = new Array(); let expectedElementNames = new Array(); expectedElementNames[0] = "employeeId"; expectedElementNames[1] = "name"; expectedElementNames[2] = "position"; expectedElementNames[3] = "salary"; expectedElementNames[4] = "gender"; expectedElementNames[5] = "address"; doc = staff.staff(); elementList = doc.getElementsByTagName("employee"); employeeNode = elementList.item(1); childNodes = employeeNode.childNodes; for (let indexN1006C = 0; indexN1006C < childNodes.length; indexN1006C++) { childNode = childNodes.item(indexN1006C); childType = childNode.nodeType; if ( (childType === 1) ) { childName = childNode.nodeName; elementNames[elementNames.length] = childName; } } assert.deepEqual(elementNames, expectedElementNames, "elementNames"); }); /** * Add an element and check that the previously retrieved childNodes NodeList is live. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1451460987 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-184E7107 */ specify("nodechildnodesappendchild", () => { let success; let doc; let elementList; let employeeNode; let childList; let createdNode; let expectedLength; let length; doc = staff.staff(); elementList = doc.getElementsByTagName("employee"); employeeNode = elementList.item(1); childList = employeeNode.childNodes; expectedLength = childList.length; expectedLength += 1; createdNode = doc.createElement("text3"); employeeNode = employeeNode.appendChild(createdNode); length = childList.length; assert.equal(length, expectedLength, "childNodeLength"); }); /** * The "getChildNodes()" method returns a NodeList that contains all children of this node. If there are not any children, this is a NodeList that does not contain any nodes. Retrieve the Text node from the second child of the second employee and invoke the "getChildNodes()" method. The NodeList returned should not have any nodes. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1451460987 */ specify("nodechildnodesempty", () => { let success; let doc; let elementList; let employeeNode; let childList; let secondCNode; let textNode; let childNodesList; doc = staff.staff(); elementList = doc.getElementsByTagName("employee"); employeeNode = elementList.item(1); childList = employeeNode.childNodes; secondCNode = childList.item(1); textNode = secondCNode.firstChild; childNodesList = textNode.childNodes; assert.equal(childNodesList.length, 0, "nodeChildNodesEmptyAssert1"); }); /** * If the cloneNode method is used to clone an Element node, all the attributes of the Element are copied along with their values. Retrieve the last child of the second employee and invoke the cloneNode method. The duplicate node returned by the method should copy the attributes associated with this node. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-84CF096 */ specify("nodecloneattributescopied", () => { let success; let doc; let elementList; let addressNode; let clonedNode; let attributes; let attributeNode; let attributeName; let result = new Array(); let expectedResult = new Array(); expectedResult[0] = "domestic"; expectedResult[1] = "street"; doc = staff.staff(); elementList = doc.getElementsByTagName("address"); addressNode = elementList.item(1); clonedNode = addressNode.cloneNode(false); attributes = clonedNode.attributes; for (let indexN10065 = 0; indexN10065 < attributes.length; indexN10065++) { attributeNode = attributes.item(indexN10065); attributeName = attributeNode.name; result[result.length] = attributeName; } domTestHelper.assertEqualsCollection(assert, result, expectedResult, "nodeCloneAttributesCopiedAssert1"); }); /** * The "cloneNode(deep)" method does not copy text unless it is deep cloned.(Test for deep=false) Retrieve the fourth child of the second employee and the "cloneNode(deep)" method with deep=false. The duplicate node returned by the method should not copy any text data contained in this node. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-3A0ED0A4 */ specify("nodeclonefalsenocopytext", () => { let success; let doc; let elementList; let employeeNode; let childList; let childNode; let clonedNode; let lastChildNode; doc = staff.staff(); elementList = doc.getElementsByTagName("employee"); employeeNode = elementList.item(1); childList = employeeNode.childNodes; childNode = childList.item(3); clonedNode = childNode.cloneNode(false); lastChildNode = clonedNode.lastChild; assert.equal(lastChildNode, null, "noTextNodes"); }); /** * The duplicate node returned by the "cloneNode(deep)" method does not have a ParentNode. Retrieve the second employee and invoke the "cloneNode(deep)" method with deep=false. The duplicate node returned should return null when the "getParentNode()" is invoked. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-3A0ED0A4 */ specify("nodeclonegetparentnull", () => { let success; let doc; let elementList; let employeeNode; let clonedNode; let parentNode; doc = staff.staff(); elementList = doc.getElementsByTagName("employee"); employeeNode = elementList.item(1); clonedNode = employeeNode.cloneNode(false); parentNode = clonedNode.parentNode; assert.equal(parentNode, null, "nodeCloneGetParentNullAssert1"); }); /** * The "cloneNode(deep)" method returns a copy of the node only if deep=false. Retrieve the second employee and invoke the "cloneNode(deep)" method with deep=false. The method should only clone this node. The NodeName and length of the NodeList are checked. The "getNodeName()" method should return "employee" and the "getLength()" method should return 0. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-3A0ED0A4 */ specify("nodeclonenodefalse", () => { let success; let doc; let elementList; let employeeNode; let clonedNode; let cloneName; let cloneChildren; let length; doc = staff.staff(); elementList = doc.getElementsByTagName("employee"); employeeNode = elementList.item(1); clonedNode = employeeNode.cloneNode(false); cloneName = clonedNode.nodeName; assert.equal(cloneName, "employee", "name"); cloneChildren = clonedNode.childNodes; length = cloneChildren.length; assert.equal(length, 0, "length"); }); /** * The "cloneNode(deep)" method returns a copy of the node and the subtree under it if deep=true. Retrieve the second employee and invoke the "cloneNode(deep)" method with deep=true. The method should clone this node and the subtree under it. The NodeName of each child in the returned node is checked to insure the entire subtree under the second employee was cloned. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-3A0ED0A4 */ specify("nodeclonenodetrue", () => { let success; let doc; let elementList; let employeeNode; let childList; let clonedNode; let clonedList; let clonedChild; let clonedChildName; let length; let result = new Array(); let expectedWhitespace = new Array(); expectedWhitespace[0] = "#text"; expectedWhitespace[1] = "employeeId"; expectedWhitespace[2] = "#text"; expectedWhitespace[3] = "name"; expectedWhitespace[4] = "#text"; expectedWhitespace[5] = "position"; expectedWhitespace[6] = "#text"; expectedWhitespace[7] = "salary"; expectedWhitespace[8] = "#text"; expectedWhitespace[9] = "gender"; expectedWhitespace[10] = "#text"; expectedWhitespace[11] = "address"; expectedWhitespace[12] = "#text"; let expectedNoWhitespace = new Array(); expectedNoWhitespace[0] = "employeeId"; expectedNoWhitespace[1] = "name"; expectedNoWhitespace[2] = "position"; expectedNoWhitespace[3] = "salary"; expectedNoWhitespace[4] = "gender"; expectedNoWhitespace[5] = "address"; doc = staff.staff(); elementList = doc.getElementsByTagName("employee"); employeeNode = elementList.item(1); childList = employeeNode.childNodes; length = childList.length; clonedNode = employeeNode.cloneNode(true); clonedList = clonedNode.childNodes; for (let indexN100AE = 0; indexN100AE < clonedList.length; indexN100AE++) { clonedChild = clonedList.item(indexN100AE); clonedChildName = clonedChild.nodeName; result[result.length] = clonedChildName; } if ( (length === 6) ) { assert.deepEqual(result, expectedNoWhitespace, "nowhitespace"); } else { assert.deepEqual(result, expectedWhitespace, "whitespace"); } }); /** * Retrieve the second salary and the "cloneNode(deep)" method with deep=true. The duplicate node returned by the method should copy any text data contained in this node. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-3A0ED0A4 */ specify("nodeclonetruecopytext", () => { let success; let doc; let elementList; let childList; let childNode; let clonedNode; let lastChildNode; let childValue; doc = staff.staff(); elementList = doc.getElementsByTagName("salary"); childNode = elementList.item(1); clonedNode = childNode.cloneNode(true); lastChildNode = clonedNode.lastChild; childValue = lastChildNode.nodeValue; assert.equal(childValue, "35,000", "nodeCloneTrueCopyTextAssert1"); }); /** * The "getAttributes()" method invoked on a Comment Node returns undefined. Find any comment that is an immediate child of the root and assert that Node.attributes is undefined. Then create a new comment node (in case they had been omitted) and make the assertion. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-84CF096 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1728279322 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=248 */ specify("nodecommentnodeattributes", () => { let success; let doc; let childList; let childNode; let attrList; let nodeType; doc = staff.staff(); childList = doc.childNodes; for (let indexN10043 = 0; indexN10043 < childList.length; indexN10043++) { childNode = childList.item(indexN10043); nodeType = childNode.nodeType; if ( (nodeType === 8) ) { attrList = childNode.attributes; assert.equal(attrList, undefined, "attributesUndefined"); } } childNode = doc.createComment("This is a comment"); attrList = childNode.attributes; assert.equal(attrList, undefined, "createdAttributesUndefined"); }); /** * The string returned by the "getNodeName()" method for a Comment Node is "#comment". Retrieve the Comment node in the XML file and check the string returned by the "getNodeName()" method. It should be equal to "#comment". * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D095 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1728279322 */ specify("nodecommentnodename", () => { let success; let doc; let elementList; let commentNode; let nodeType; let commentNodeName; doc = staff.staff(); elementList = doc.childNodes; for (let indexN10040 = 0; indexN10040 < elementList.length; indexN10040++) { commentNode = elementList.item(indexN10040); nodeType = commentNode.nodeType; if ( (nodeType === 8) ) { commentNodeName = commentNode.nodeName; assert.equal(commentNodeName, "#comment", "commentNodeName"); } } }); /** * The "getNodeType()" method for a Comment Node returns the constant value 8. Retrieve the nodes from the document and check for a comment node and invoke the "getNodeType()" method. This should return 8. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-111237558 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1728279322 */ specify("nodecommentnodetype", () => { let success; let doc; let testList; let commentNode; let commentNodeName; let nodeType; doc = staff.staff(); testList = doc.childNodes; for (let indexN10040 = 0; indexN10040 < testList.length; indexN10040++) { commentNode = testList.item(indexN10040); commentNodeName = commentNode.nodeName; if ( (commentNodeName === "#comment") ) { nodeType = commentNode.nodeType; assert.equal(nodeType, 8, "nodeCommentNodeTypeAssert1"); } } }); /** * The string returned by the "getNodeValue()" method for a Comment Node is the content of the comment. Retrieve the comment in the XML file and check the string returned by the "getNodeValue()" method. It should be equal to "This is comment number 1". * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D080 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1728279322 */ specify("nodecommentnodevalue", () => { let success; let doc; let elementList; let commentNode; let commentName; let commentValue; doc = staff.staff(); elementList = doc.childNodes; for (let indexN10040 = 0; indexN10040 < elementList.length; indexN10040++) { commentNode = elementList.item(indexN10040); commentName = commentNode.nodeName; if ( (commentName === "#comment") ) { commentValue = commentNode.nodeValue; assert.equal(commentValue, " This is comment number 1.", "value"); } } }); /** * The string returned by the "getNodeName()" method for a DocumentFragment Node is "#document-frament". Retrieve the DOM document and invoke the "createDocumentFragment()" method and check the string returned by the "getNodeName()" method. It should be equal to "#document-fragment". * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D095 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-B63ED1A3 */ specify("nodedocumentfragmentnodename", () => { let success; let doc; let docFragment; let documentFragmentName; doc = staff.staff(); docFragment = doc.createDocumentFragment(); documentFragmentName = docFragment.nodeName; assert.equal(documentFragmentName, "#document-fragment", "nodeDocumentFragmentNodeNameAssert1"); }); /** * The "getNodeType()" method for a DocumentFragment Node returns the constant value 11. Invoke the "createDocumentFragment()" method and examine the NodeType of the document fragment returned by the "getNodeType()" method. The method should return 11. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-111237558 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-B63ED1A3 */ specify("nodedocumentfragmentnodetype", () => { let success; let doc; let documentFragmentNode; let nodeType; doc = staff.staff(); documentFragmentNode = doc.createDocumentFragment(); nodeType = documentFragmentNode.nodeType; assert.equal(nodeType, 11, "nodeDocumentFragmentNodeTypeAssert1"); }); /** * The string returned by the "getNodeValue()" method for a DocumentFragment Node is null. Retrieve the DOM document and invoke the "createDocumentFragment()" method and check the string returned by the "getNodeValue()" method. It should be equal to null. * @author NIST * @author Mary Brady * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-B63ED1A3 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D080 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-84CF096 */ specify("nodedocumentfragmentnodevalue", () => { let success; let doc; let docFragment; let attrList; let value; doc = staff.staff(); docFragment = doc.createDocumentFragment(); attrList = docFragment.attributes; assert.equal(attrList, null, "attributesNull"); value = docFragment.nodeValue; assert.equal(value, null, "initiallyNull"); }); /** * The "getAttributes()" method invoked on a Document Node returns null. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-84CF096 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#i-Document */ specify("nodedocumentnodeattribute", () => { let success; let doc; let attrList; doc = staff.staff(); attrList = doc.attributes; assert.equal(attrList, null, "documentAttributesNull"); }); /** * The string returned by the "getNodeName()" method for a Document Node is "#document". Retrieve the DOM document and check the string returned by the "getNodeName()" method. It should be equal to "#document". * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#i-Document * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D095 */ specify("nodedocumentnodename", () => { let success; let doc; let documentName; doc = staff.staff(); documentName = doc.nodeName; assert.equal(documentName, "#document", "documentNodeName"); }); /** * The "getNodeType()" method for a Document Node returns the constant value 9. Retrieve the document and invoke the "getNodeType()" method. The method should return 9. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#i-Document * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-111237558 */ specify("nodedocumentnodetype", () => { let success; let doc; let nodeType; doc = staff.staff(); nodeType = doc.nodeType; assert.equal(nodeType, 9, "nodeDocumentNodeTypeAssert1"); }); /** * The string returned by the "getNodeValue()" method for a Document Node is null. Retrieve the DOM Document and check the string returned by the "getNodeValue()" method. It should be equal to null. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#i-Document * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D080 */ specify("nodedocumentnodevalue", () => { let success; let doc; let documentValue; doc = staff.staff(); documentValue = doc.nodeValue; assert.equal(documentValue, null, "documentNodeValueNull"); }); /** * Retrieve the DOCTYPE declaration from the XML file and check the string returned by the "getNodeName()" method. It should be equal to "staff" or "svg". * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D095 */ specify("nodedocumenttypenodename", () => { let success; let doc; let docType; let documentTypeName; doc = staff.staff(); docType = doc.doctype; assert.notEqual(docType, null, "docTypeNotNull"); documentTypeName = docType.nodeName; assert.equal(documentTypeName, "staff", "documentName"); }); /** * The "getNodeType()" method for a DocumentType Node returns the constant value 10. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-111237558 */ specify("nodedocumenttypenodetype", () => { let success; let doc; let documentTypeNode; let nodeType; doc = staff.staff(); documentTypeNode = doc.doctype; assert.notEqual(documentTypeNode, null, "doctypeNotNull"); nodeType = documentTypeNode.nodeType; assert.equal(nodeType, 10, "nodeType"); }); /** * The string returned by the "getNodeValue()" method for a DocumentType Node is null. * @author NIST * @author Mary Brady */ specify("nodedocumenttypenodevalue", () => { let success; let doc; let docType; let attrList; doc = staff.staff(); docType = doc.doctype; assert.notEqual(docType, null, "docTypeNotNull"); attrList = docType.attributes; assert.equal(attrList, null, "doctypeAttributesNull"); }); /** * The "getAttributes()" method invoked on an Element Node returns a NamedNodeMap containing the attributes of this node. Retrieve the last child of the third employee and invoke the "getAttributes()" method. It should return a NamedNodeMap containing the attributes of the Element node. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-84CF096 */ specify("nodeelementnodeattributes", () => { let success; let doc; let elementList; let testAddr; let addrAttr; let attrNode; let attrName; let attrList = new Array(); let expected = new Array(); expected[0] = "domestic"; expected[1] = "street"; doc = staff.staff(); elementList = doc.getElementsByTagName("address"); testAddr = elementList.item(2); addrAttr = testAddr.attributes; for (let indexN1005C = 0; indexN1005C < addrAttr.length; indexN1005C++) { attrNode = addrAttr.item(indexN1005C); attrName = attrNode.name; attrList[attrList.length] = attrName; } domTestHelper.assertEqualsCollection(assert, attrList, expected, "nodeElementNodeValueAssert1"); }); /** * The string returned by the "getNodeName()" method for an Element Node is its tagName. Retrieve the first Element Node(Root Node) of the DOM object and check the string returned by the "getNodeName()" method. It should be equal to its tagName. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D095 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=251 */ specify("nodeelementnodename", () => { let success; let doc; let elementNode; let elementName; doc = staff.staff(); elementNode = doc.documentElement; elementName = elementNode.nodeName; assert.equal(elementName, "staff", "nodeElementNodeNameAssert1"); }); /** * The "getNodeType()" method for an Element Node returns the constant value 1. Retrieve the root node and invoke the "getNodeType()" method. The method should return 1. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-111237558 */ specify("nodeelementnodetype", () => { let success; let doc; let rootNode; let nodeType; doc = staff.staff(); rootNode = doc.documentElement; nodeType = rootNode.nodeType; assert.equal(nodeType, 1, "nodeElementNodeTypeAssert1"); }); /** * The string returned by the "getNodeValue()" method for an Element Node is null. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D080 */ specify("nodeelementnodevalue", () => { let success; let doc; let elementNode; let elementValue; doc = staff.staff(); elementNode = doc.documentElement; elementValue = elementNode.nodeValue; assert.equal(elementValue, null, "elementNodeValueNull"); }); /** * The "getFirstChild()" method returns the first child of this node. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-169727388 */ specify("nodegetfirstchild", () => { let success; let doc; let elementList; let employeeNode; let fchildNode; let childName; doc = staff.staff(); elementList = doc.getElementsByTagName("employee"); employeeNode = elementList.item(1); fchildNode = employeeNode.firstChild; childName = fchildNode.nodeName; if ( (childName === "#text") ) { fchildNode = fchildNode.nextSibling; childName = fchildNode.nodeName; } assert.equal(childName, "employeeId", "nodeName"); }); /** * If there is not a first child then the "getFirstChild()" method returns null. Retrieve the Text node form the second child of the first employee and invoke the "getFirstChild()" method. It should return null. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-169727388 */ specify("nodegetfirstchildnull", () => { let success; let doc; let elementList; let employeeNode; let employeeList; let secondChildNode; let textNode; let noChildNode; doc = staff.staff(); elementList = doc.getElementsByTagName("employee"); employeeNode = elementList.item(0); employeeList = employeeNode.childNodes; secondChildNode = employeeList.item(1); textNode = secondChildNode.firstChild; noChildNode = textNode.firstChild; assert.equal(noChildNode, null, "nodeGetFirstChildNullAssert1"); }); /** * The "getLastChild()" method returns the last child of this node. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-61AD09FB */ specify("nodegetlastchild", () => { let success; let doc; let elementList; let employeeNode; let lchildNode; let childName; doc = staff.staff(); elementList = doc.getElementsByTagName("employee"); employeeNode = elementList.item(1); lchildNode = employeeNode.lastChild; childName = lchildNode.nodeName; if ( (childName === "#text") ) { lchildNode = lchildNode.previousSibling; childName = lchildNode.nodeName; } assert.equal(childName, "address", "nodeName"); }); /** * If there is not a last child then the "getLastChild()" method returns null. Retrieve the Text node from the second child of the first employee and invoke the "getLastChild()" method. It should return null. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-61AD09FB */ specify("nodegetlastchildnull", () => { let success; let doc; let elementList; let employeeNode; let employeeList; let secondChildNode; let textNode; let noChildNode; doc = staff.staff(); elementList = doc.getElementsByTagName("employee"); employeeNode = elementList.item(0); employeeList = employeeNode.childNodes; secondChildNode = employeeList.item(1); textNode = secondChildNode.firstChild; noChildNode = textNode.lastChild; assert.equal(noChildNode, null, "nodeGetLastChildNullAssert1"); }); /** * The "getNextSibling()" method returns the node immediately following this node. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-6AC54C2F */ specify("nodegetnextsibling", () => { let success; let doc; let elementList; let employeeIdNode; let nsNode; let nsName; doc = staff.staff(); elementList = doc.getElementsByTagName("employeeId"); employeeIdNode = elementList.item(1); nsNode = employeeIdNode.nextSibling; nsName = nsNode.nodeName; if ( (nsName === "#text") ) { nsNode = nsNode.nextSibling; nsName = nsNode.nodeName; } assert.equal(nsName, "name", "nodeName"); }); /** * If there is not a node immediately following this node the "getNextSibling()" method returns null. Retrieve the first child of the second employee and invoke the "getNextSibling()" method. It should be set to null. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-6AC54C2F */ specify("nodegetnextsiblingnull", () => { let success; let doc; let elementList; let employeeNode; let lcNode; let nsNode; doc = staff.staff(); elementList = doc.getElementsByTagName("employee"); employeeNode = elementList.item(1); lcNode = employeeNode.lastChild; nsNode = lcNode.nextSibling; assert.equal(nsNode, null, "nodeGetNextSiblingNullAssert1"); }); /** * The "getOwnerDocument()" method returns the Document object associated with this node. Retrieve the second employee and examine Document returned by the "getOwnerDocument()" method. Invoke the "getDocumentElement()" on the Document which will return an Element that is equal to "staff". * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#node-ownerDoc * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=251 */ specify("nodegetownerdocument", () => { let success; let doc; let elementList; let docNode; let ownerDocument; let docElement; let elementName; doc = staff.staff(); elementList = doc.getElementsByTagName("employee"); docNode = elementList.item(1); ownerDocument = docNode.ownerDocument; docElement = ownerDocument.documentElement; elementName = docElement.nodeName; assert.equal(elementName, "staff", "nodeGetOwnerDocumentAssert1"); }); /** * The "getOwnerDocument()" method returns null if the target node itself is a document. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#node-ownerDoc */ specify("nodegetownerdocumentnull", () => { let success; let doc; let ownerDocument; doc = staff.staff(); ownerDocument = doc.ownerDocument; assert.equal(ownerDocument, null, "documentOwnerDocumentNull"); }); /** * The "getPreviousSibling()" method returns the node immediately preceding this node. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-640FB3C8 */ specify("nodegetprevioussibling", () => { let success; let doc; let elementList; let nameNode; let psNode; let psName; doc = staff.staff(); elementList = doc.getElementsByTagName("name"); nameNode = elementList.item(1); psNode = nameNode.previousSibling; psName = psNode.nodeName; if ( (psName === "#text") ) { psNode = psNode.previousSibling; psName = psNode.nodeName; } assert.equal(psName, "employeeId", "nodeName"); }); /** * If there is not a node immediately preceding this node the "getPreviousSibling()" method returns null. Retrieve the first child of the second employee and invoke the "getPreviousSibling()" method. It should be set to null. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-640FB3C8 */ specify("nodegetprevioussiblingnull", () => { let success; let doc; let elementList; let employeeNode; let fcNode; let psNode; doc = staff.staff(); elementList = doc.getElementsByTagName("employee"); employeeNode = elementList.item(2); fcNode = employeeNode.firstChild; psNode = fcNode.previousSibling; assert.equal(psNode, null, "nodeGetPreviousSiblingNullAssert1"); }); /** * The "hasChildNodes()" method returns true if the node has children. Retrieve the root node("staff") and invoke the "hasChildNodes()" method. It should return the boolean value "true". * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-810594187 */ specify("nodehaschildnodes", () => { let success; let doc; let elementList; let employeeNode; let state; doc = staff.staff(); elementList = doc.getElementsByTagName("employee"); employeeNode = elementList.item(1); state = employeeNode.hasChildNodes(); assert.ok(state, "nodeHasChildAssert1"); }); /** * The "hasChildNodes()" method returns false if the node does not have any children. Retrieve the Text node inside the first child of the second employee and invoke the "hasChildNodes()" method. It should return the boolean value "false". * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1451460987 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-810594187 */ specify("nodehaschildnodesfalse", () => { let success; let doc; let elementList; let child; let employeeIdList; let employeeNode; let textNode; let state; doc = staff.staff(); elementList = doc.getElementsByTagName("employee"); child = elementList.item(1); employeeIdList = child.childNodes; employeeNode = employeeIdList.item(1); textNode = employeeNode.firstChild; state = textNode.hasChildNodes(); assert.equal(state, false, "nodeHasChildFalseAssert1"); }); /** * The "insertBefore(newChild,refChild)" method inserts the node "newChild" before the node "refChild". Insert a newly created Element node before the eigth child of the second employee and check the "newChild" and "refChild" after insertion for correct placement. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-952280727 */ specify("nodeinsertbefore", () => { let success; let doc; let elementList; let employeeNode; let childList; let refChild; let newChild; let child; let childName; let length; let insertedNode; let actual = new Array(); let expectedWithWhitespace = new Array(); expectedWithWhitespace[0] = "#text"; expectedWithWhitespace[1] = "employeeId"; expectedWithWhitespace[2] = "#text"; expectedWithWhitespace[3] = "name"; expectedWithWhitespace[4] = "#text"; expectedWithWhitespace[5] = "position"; expectedWithWhitespace[6] = "#text"; expectedWithWhitespace[7] = "newChild"; expectedWithWhitespace[8] = "salary"; expectedWithWhitespace[9] = "#text"; expectedWithWhitespace[10] = "gender"; expectedWithWhitespace[11] = "#text"; expectedWithWhitespace[12] = "address"; expectedWithWhitespace[13] = "#text"; let expectedWithoutWhitespace = new Array(); expectedWithoutWhitespace[0] = "employeeId"; expectedWithoutWhitespace[1] = "name"; expectedWithoutWhitespace[2] = "position"; expectedWithoutWhitespace[3] = "newChild"; expectedWithoutWhitespace[4] = "salary"; expectedWithoutWhitespace[5] = "gender"; expectedWithoutWhitespace[6] = "address"; let expected = new Array(); doc = staff.staff(); elementList = doc.getElementsByTagName("employee"); employeeNode = elementList.item(1); childList = employeeNode.childNodes; length = childList.length; if ( (length === 6) ) { refChild = childList.item(3); expected = expectedWithoutWhitespace; } else { refChild = childList.item(7); expected = expectedWithWhitespace; } newChild = doc.createElement("newChild"); insertedNode = employeeNode.insertBefore(newChild, refChild); for (let indexN100DC = 0; indexN100DC < childList.length; indexN100DC++) { child = childList.item(indexN100DC); childName = child.nodeName; actual[actual.length] = childName; } assert.deepEqual(actual, expected, "nodeNames"); }); /** * If the "newChild" is a DocumentFragment object then all its children are inserted in the same order before the the "refChild". Create a DocumentFragment object and populate it with two Element nodes. Retrieve the second employee and insert the newly created DocumentFragment before its fourth child. The second employee should now have two extra children("newChild1" and "newChild2") at positions fourth and fifth respectively. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-952280727 */ specify("nodeinsertbeforedocfragment", () => { let success; let doc; let elementList; let employeeNode; let childList; let refChild; let newdocFragment; let newChild1; let newChild2; let child; let childName; let appendedChild; let insertedNode; doc = staff.staff(); elementList = doc.getElementsByTagName("employee"); employeeNode = elementList.item(1); childList = employeeNode.childNodes; refChild = childList.item(3); newdocFragment = doc.createDocumentFragment(); newChild1 = doc.createElement("newChild1"); newChild2 = doc.createElement("newChild2"); appendedChild = newdocFragment.appendChild(newChild1); appendedChild = newdocFragment.appendChild(newChild2); insertedNode = employeeNode.insertBefore(newdocFragment, refChild); child = childList.item(3); childName = child.nodeName; assert.equal(childName, "newChild1", "childName3"); child = childList.item(4); childName = child.nodeName; assert.equal(childName, "newChild2", "childName4"); }); /** * If the "newChild" is already in the tree, the "insertBefore(newChild,refChild)" method must first remove it before the insertion takes place. Insert a node Element ("employeeId") that is already present in the tree. The existing node should be removed first and the new one inserted. The node is inserted at a different position in the tree to assure that it was indeed inserted. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-952280727 */ specify("nodeinsertbeforenewchildexists", () => { let success; let doc; let elementList; let employeeNode; let childList; let refChild; let newChild; let child; let length; let childName; let insertedNode; let expectedWhitespace = new Array(); expectedWhitespace[0] = "#text"; expectedWhitespace[1] = "#text"; expectedWhitespace[2] = "name"; expectedWhitespace[3] = "#text"; expectedWhitespace[4] = "position"; expectedWhitespace[5] = "#text"; expectedWhitespace[6] = "salary"; expectedWhitespace[7] = "#text"; expectedWhitespace[8] = "gender"; expectedWhitespace[9] = "#text"; expectedWhitespace[10] = "employeeId"; expectedWhitespace[11] = "address"; expectedWhitespace[12] = "#text"; let expectedNoWhitespace = new Array(); expectedNoWhitespace[0] = "name"; expectedNoWhitespace[1] = "position"; expectedNoWhitespace[2] = "salary"; expectedNoWhitespace[3] = "gender"; expectedNoWhitespace[4] = "employeeId"; expectedNoWhitespace[5] = "address"; let expected = new Array(); let result = new Array(); doc = staff.staff(); elementList = doc.getElementsByTagName("employee"); employeeNode = elementList.item(1); childList = employeeNode.childNodes; length = childList.length; if ( (length === 6) ) { expected = expectedNoWhitespace; refChild = childList.item(5); newChild = childList.item(0); } else { expected = expectedWhitespace; refChild = childList.item(11); newChild = childList.item(1); } insertedNode = employeeNode.insertBefore(newChild, refChild); for (let indexN100DD = 0; indexN100DD < childList.length; indexN100DD++) { child = childList.item(indexN100DD); childName = child.nodeName; result[result.length] = childName; } assert.deepEqual(result, expected, "childNames"); }); /** * The "insertBefore(newChild,refChild)" method raises a HIERARCHY_REQUEST_ERR DOMException if the node to be inserted is one of this nodes ancestors. Retrieve the second employee and attempt to insert a node that is one of its ancestors(root node). An attempt to insert such a node should raise the desired exception. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='HIERARCHY_REQUEST_ERR']) * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-952280727 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-952280727')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='HIERARCHY_REQUEST_ERR']) * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-952280727 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=249 */ specify("nodeinsertbeforenodeancestor", () => { let success; let doc; let newChild; let elementList; let employeeNode; let childList; let refChild; let insertedNode; doc = staff.staff(); newChild = doc.documentElement; elementList = doc.getElementsByTagName("employee"); employeeNode = elementList.item(1); childList = employeeNode.childNodes; refChild = childList.item(0); { success = false; try { insertedNode = employeeNode.insertBefore(newChild, refChild); } catch (ex) { success = (typeof (ex.code) !== "undefined" && ex.code === 3); } assert.ok(success, "throw_HIERARCHY_REQUEST_ERR"); } }); /** * The "insertBefore(newChild,refchild)" method returns the node being inserted. Insert an Element node before the fourth child of the second employee and check the node returned from the "insertBefore(newChild,refChild)" method. The node returned should be "newChild". * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D095 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-952280727 */ specify("nodeinsertbeforenodename", () => { let success; let doc; let elementList; let employeeNode; let childList; let refChild; let newChild; let insertedNode; let childName; doc = staff.staff(); elementList = doc.getElementsByTagName("employee"); employeeNode = elementList.item(1); childList = employeeNode.childNodes; refChild = childList.item(3); newChild = doc.createElement("newChild"); insertedNode = employeeNode.insertBefore(newChild, refChild); childName = insertedNode.nodeName; assert.equal(childName, "newChild", "nodeInsertBeforeNodeNameAssert1"); }); /** * The "insertBefore(newChild,refChild)" method raises a NOT_FOUND_ERR DOMException if the reference child is not a child of this node. Retrieve the second employee and attempt to insert a new node before a reference node that is not a child of this node. An attempt to insert before a non child node should raise the desired exception. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='NOT_FOUND_ERR']) * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-952280727 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-952280727')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NOT_FOUND_ERR']) * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-952280727 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=249 */ specify("nodeinsertbeforerefchildnonexistent", () => { let success; let doc; let refChild; let newChild; let elementList; let elementNode; let insertedNode; doc = staff.staff(); newChild = doc.createElement("newChild"); refChild = doc.createElement("refChild"); elementList = doc.getElementsByTagName("employee"); elementNode = elementList.item(1); { success = false; try { insertedNode = elementNode.insertBefore(newChild, refChild); } catch (ex) { success = (typeof (ex.code) !== "undefined" && ex.code === 8); } assert.ok(success, "throw_NOT_FOUND_ERR"); } }); /** * If the "refChild" is null then the "insertBefore(newChild,refChild)" method inserts the node "newChild" at the end of the list of children. Retrieve the second employee and invoke the "insertBefore(newChild,refChild)" method with refChild=null. Since "refChild" is null the "newChild" should be added to the end of the list. The last item in the list is checked after insertion. The last Element node of the list should be "newChild". * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-952280727 */ specify("nodeinsertbeforerefchildnull", () => { let success; let doc; let elementList; let employeeNode; let childList; let refChild = null; let newChild; let child; let childName; let insertedNode; doc = staff.staff(); elementList = doc.getElementsByTagName("employee"); employeeNode = elementList.item(1); childList = employeeNode.childNodes; newChild = doc.createElement("newChild"); insertedNode = employeeNode.insertBefore(newChild, refChild); child = employeeNode.lastChild; childName = child.nodeName; assert.equal(childName, "newChild", "nodeInsertBeforeRefChildNullAssert1"); }); /** * Create a list of all the children elements of the third employee and access its first child by using an index of 0. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-844377136 */ specify("nodelistindexequalzero", () => { let success; let doc; let elementList; let employeeNode; let employeeList; let child; let childName; doc = staff.staff(); elementList = doc.getElementsByTagName("employee"); employeeNode = elementList.item(2); employeeList = employeeNode.childNodes; child = employeeList.item(0); childName = child.nodeName; if ( !(childName === "#text") ) { assert.equal(childName, "employeeId", "childName"); } }); /** * The "getLength()" method returns the number of nodes in the list should be 13. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-203510337 */ specify("nodelistindexgetlength", () => { let doc = staff.staff(); let employeeList = doc.getElementsByTagName("employee").item(2).childNodes; assert.equal(employeeList.length, 13); }); /** * The "getLength()" method returns the number of nodes in the list.(Test for EMPTY list) Create a list of all the children of the Text node inside the first child of the third employee and invoke the "getLength()" method. It should contain the value 0. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-203510337 */ specify("nodelistindexgetlengthofemptylist", () => { let success; let doc; let elementList; let employeeNode; let employeeList; let childNode; let textNode; let textList; doc = staff.staff(); elementList = doc.getElementsByTagName("employee"); employeeNode = elementList.item(2); employeeList = employeeNode.childNodes; childNode = employeeList.item(1); textNode = childNode.firstChild; textList = textNode.childNodes; assert.equal(textList.length, 0, "nodelistIndexGetLengthOfEmptyListAssert"); }); /** * Create a list of all the children elements of the third employee and access its fourth child by using an index of 3. This should result in "name" being selected. Further we evaluate its content(by using the "getNodeName()" method) to ensure the proper element was accessed. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-844377136 */ specify("nodelistindexnotzero", () => { let success; let doc; let elementList; let employeeNode; let employeeList; let child; let length; let childName; doc = staff.staff(); elementList = doc.getElementsByTagName("employee"); employeeNode = elementList.item(2); employeeList = employeeNode.childNodes; length = employeeList.length; if ( (length === 6) ) { child = employeeList.item(1); } else { child = employeeList.item(3); } childName = child.nodeName; assert.equal(childName, "name", "nodeName"); }); /** * Get the first child of the third employee using NodeList.item(0) which will either be a Text node (whitespace) or employeeId element. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-844377136 */ specify("nodelistreturnfirstitem", () => { let success; let doc; let elementList; let employeeNode; let employeeList; let child; let childName; let length; doc = staff.staff(); elementList = doc.getElementsByTagName("employee"); employeeNode = elementList.item(2); employeeList = employeeNode.childNodes; child = employeeList.item(0); childName = child.nodeName; length = employeeList.length; if ( (length === 6) ) { assert.equal(childName, "employeeId", "firstChildNoWhitespace"); } else { assert.equal(childName, "#text", "firstChildWithWhitespace"); } }); /** * Get this last child of the third employee using NodeList.item(NodeList.length - 1) and check that it is either a Text element (with whitespace) or an address element. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-844377136 */ specify("nodelistreturnlastitem", () => { let success; let doc; let elementList; let employeeNode; let employeeList; let child; let childName; let length; doc = staff.staff(); elementList = doc.getElementsByTagName("employee"); employeeNode = elementList.item(2); employeeList = employeeNode.childNodes; length = employeeList.length; if ( (length === 6) ) { child = employeeList.item(5); childName = child.nodeName; assert.equal(childName, "address", "nodeName1"); } else { child = employeeList.item(12); childName = child.nodeName; assert.equal(childName, "#text", "nodeName2"); } }); /** * The range of valid child node indices is 0 thru length -1 Create a list of all the children elements of the third employee and traverse the list from index=0 thru length -1. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-203510337 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-844377136 */ specify("nodelisttraverselist", () => { let success; let doc; let elementList; let employeeNode; let employeeList; let child; let childName; let result = new Array(); let length; let expectedWhitespace = new Array(); expectedWhitespace[0] = "#text"; expectedWhitespace[1] = "employeeId"; expectedWhitespace[2] = "#text"; expectedWhitespace[3] = "name"; expectedWhitespace[4] = "#text"; expectedWhitespace[5] = "position"; expectedWhitespace[6] = "#text"; expectedWhitespace[7] = "salary"; expectedWhitespace[8] = "#text"; expectedWhitespace[9] = "gender"; expectedWhitespace[10] = "#text"; expectedWhitespace[11] = "address"; expectedWhitespace[12] = "#text"; let expectedNoWhitespace = new Array(); expectedNoWhitespace[0] = "employeeId"; expectedNoWhitespace[1] = "name"; expectedNoWhitespace[2] = "position"; expectedNoWhitespace[3] = "salary"; expectedNoWhitespace[4] = "gender"; expectedNoWhitespace[5] = "address"; doc = staff.staff(); elementList = doc.getElementsByTagName("employee"); employeeNode = elementList.item(2); employeeList = employeeNode.childNodes; length = employeeList.length; for (let indexN100A4 = 0; indexN100A4 < employeeList.length; indexN100A4++) { child = employeeList.item(indexN100A4); childName = child.nodeName; result[result.length] = childName; } if ( (length === 6) ) { assert.deepEqual(result, expectedNoWhitespace, "nowhitespace"); } else { assert.deepEqual(result, expectedWhitespace, "whitespace"); } }); /** * The "getParentNode()" method returns the parent of this node. Retrieve the second employee and invoke the "getParentNode()" method on this node. It should be set to "staff". * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1060184317 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=251 */ specify("nodeparentnode", () => { let success; let doc; let elementList; let employeeNode; let parentNode; let parentName; doc = staff.staff(); elementList = doc.getElementsByTagName("employee"); employeeNode = elementList.item(1); parentNode = employeeNode.parentNode; parentName = parentNode.nodeName; assert.equal(parentName, "staff", "nodeParentNodeAssert1"); }); /** * The "getParentNode()" method invoked on a node that has just been created and not yet added to the tree is null. Create a new "employee" Element node using the "createElement(name)" method from the Document interface. Since this new node has not yet been added to the tree, the "getParentNode()" method will return null. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1060184317 */ specify("nodeparentnodenull", () => { let success; let doc; let createdNode; let parentNode; doc = staff.staff(); createdNode = doc.createElement("employee"); parentNode = createdNode.parentNode; assert.equal(parentNode, null, "parentNode"); }); /** * The "getAttributes()" method invoked on a Processing Instruction Node returns null. Retrieve the Processing Instruction node and invoke the "getAttributes()" method. It should return null. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-84CF096 */ specify("nodeprocessinginstructionnodeattributes", () => { let success; let doc; let testList; let piNode; let attrList; doc = staff.staff(); testList = doc.childNodes; piNode = testList.item(0); attrList = piNode.attributes; assert.equal(attrList, null, "nodeProcessingInstructionNodeAttrAssert1"); }); /** * The string returned by the "getNodeName()" method for a Processing Instruction Node is the target. Retrieve the Processing Instruction Node in the XML file and check the string returned by the "getNodeName()" method. It should be equal to "XML-STYLE". * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D095 */ specify("nodeprocessinginstructionnodename", () => { let success; let doc; let testList; let piNode; let piName; doc = staff.staff(); testList = doc.childNodes; piNode = testList.item(0); piName = piNode.nodeName; assert.equal(piName, "TEST-STYLE", "nodeProcessingInstructionNodeNameAssert1"); }); /** * The "getNodeType()" method for a Processing Instruction node returns the constant value 7. Retrieve a NodeList of child elements from the document. Retrieve the first child and invoke the "getNodeType()" method. The method should return 7. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-111237558 */ specify("nodeprocessinginstructionnodetype", () => { let success; let doc; let testList; let piNode; let nodeType; doc = staff.staff(); testList = doc.childNodes; piNode = testList.item(0); nodeType = piNode.nodeType; assert.equal(nodeType, 7, "nodeProcessingInstructionNodeTypeAssert1"); }); /** * The string returned by the "getNodeValue()" method for a Processing Instruction Node is the content of the Processing Instruction(exclude the target). Retrieve the Processing Instruction node in the XML file and check the string returned by the "getNodeValue()" method. It should be equal to "PIDATA". * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D080 */ specify("nodeprocessinginstructionnodevalue", () => { let success; let doc; let testList; let piNode; let piValue; doc = staff.staff(); testList = doc.childNodes; piNode = testList.item(0); piValue = piNode.nodeValue; assert.equal(piValue, "PIDATA", "value"); }); /** * Setting the nodeValue should change the value returned by nodeValue and ProcessingInstruction.getData. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D080 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1004215813 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-837822393 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=181 */ specify("nodeprocessinginstructionsetnodevalue", () => { let success; let doc; let testList; let piNode; let piValue; doc = staff.staff(); testList = doc.childNodes; piNode = testList.item(0); piNode.nodeValue = "Something different"; piValue = piNode.nodeValue; assert.equal(piValue, "Something different", "nodeValue"); piValue = piNode.data; assert.equal(piValue, "Something different", "data"); }); /** * The "removeChild(oldChild)" method removes the child node indicated by "oldChild" from the list of children and returns it. Remove the first employee by invoking the "removeChild(oldChild)" method an checking the node returned by the "getParentNode()" method. It should be set to null. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1734834066 */ specify("noderemovechild", () => { let success; let doc; let rootNode; let childList; let childToRemove; let removedChild; let parentNode; doc = staff.staff(); rootNode = doc.documentElement; childList = rootNode.childNodes; childToRemove = childList.item(1); removedChild = rootNode.removeChild(childToRemove); parentNode = removedChild.parentNode; assert.equal(parentNode, null, "nodeRemoveChildAssert1"); }); /** * Remove the first child of the second employee and check the NodeName returned by the "removeChild(oldChild)" method. The returned node should have a NodeName equal to "#text" or employeeId depending on whitespace. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D095 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1734834066 */ specify("noderemovechildgetnodename", () => { let success; let doc; let elementList; let employeeNode; let childList; let oldChild; let removedChild; let childName; let length; doc = staff.staff(); elementList = doc.getElementsByTagName("employee"); employeeNode = elementList.item(1); childList = employeeNode.childNodes; length = childList.length; oldChild = childList.item(0); removedChild = employeeNode.removeChild(oldChild); childName = removedChild.nodeName; if ( (length === 6) ) { assert.equal(childName, "employeeId", "nowhitespace"); } else { assert.equal(childName, "#text", "whitespace"); } }); /** * Retrieve the second employee and remove its first child. After the removal, the second employee should have five or twelve children and the first child should now be the child that used to be at the second position in the list. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1734834066 */ specify("noderemovechildnode", () => { let success; let doc; let elementList; let employeeNode; let childList; let oldChild; let child; let childName; let length; let removedChild; let removedName; doc = staff.staff(); elementList = doc.getElementsByTagName("employee"); employeeNode = elementList.item(1); childList = employeeNode.childNodes; oldChild = childList.item(0); removedChild = employeeNode.removeChild(oldChild); removedName = removedChild.nodeName; child = childList.item(0); childName = child.nodeName; length = childList.length; if ( (length === 5) ) { assert.equal(removedName, "employeeId", "removedNameNoWhitespace"); assert.equal(childName, "name", "childNameNoWhitespace"); } else { assert.equal(removedName, "#text", "removedName"); assert.equal(childName, "employeeId", "childName"); assert.equal(length, 12, "length"); } }); /** * The "removeChild(oldChild)" method raises a NOT_FOUND_ERR DOMException if the old child is not a child of this node. Retrieve the second employee and attempt to remove a node that is not one of its children. An attempt to remove such a node should raise the desired exception. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='NOT_FOUND_ERR']) * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1734834066 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-1734834066')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NOT_FOUND_ERR']) * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1734834066 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=249 */ specify("noderemovechildoldchildnonexistent", () => { let success; let doc; let oldChild; let elementList; let elementNode; let removedChild; doc = staff.staff(); oldChild = doc.createElement("oldChild"); elementList = doc.getElementsByTagName("employee"); elementNode = elementList.item(1); { success = false; try { removedChild = elementNode.removeChild(oldChild); } catch (ex) { success = (typeof (ex.code) !== "undefined" && ex.code === 8); } assert.ok(success, "throw_NOT_FOUND_ERR"); } }); /** * The "replaceChild(newChild,oldChild)" method replaces the node "oldChild" with the node "newChild". Replace the first element of the second employee with a newly created Element node. Check the first position after the replacement operation is completed. The new Element should be "newChild". * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-785887307 */ specify("nodereplacechild", () => { let success; let doc; let elementList; let employeeNode; let childList; let oldChild; let newChild; let child; let childName; let replacedNode; doc = staff.staff(); elementList = doc.getElementsByTagName("employee"); employeeNode = elementList.item(1); childList = employeeNode.childNodes; oldChild = childList.item(0); newChild = doc.createElement("newChild"); replacedNode = employeeNode.replaceChild(newChild, oldChild); child = childList.item(0); childName = child.nodeName; assert.equal(childName, "newChild", "nodeReplaceChildAssert1"); }); /** * Retrieve the second employee and replace its TWELFTH child(address) with its SECOND child(employeeId). After the replacement the second child should now be the one that used to be at the third position and the TWELFTH child should be the one that used to be at the SECOND position. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-785887307 */ specify("nodereplacechildnewchildexists", () => { let success; let doc; let elementList; let employeeNode; let childList; let oldChild = null; let newChild = null; let childName; let childNode; let length; let actual = new Array(); let expected = new Array(); let expectedWithoutWhitespace = new Array(); expectedWithoutWhitespace[0] = "name"; expectedWithoutWhitespace[1] = "position"; expectedWithoutWhitespace[2] = "salary"; expectedWithoutWhitespace[3] = "gender"; expectedWithoutWhitespace[4] = "employeeId"; let expectedWithWhitespace = new Array(); expectedWithWhitespace[0] = "#text"; expectedWithWhitespace[1] = "#text"; expectedWithWhitespace[2] = "name"; expectedWithWhitespace[3] = "#text"; expectedWithWhitespace[4] = "position"; expectedWithWhitespace[5] = "#text"; expectedWithWhitespace[6] = "salary"; expectedWithWhitespace[7] = "#text"; expectedWithWhitespace[8] = "gender"; expectedWithWhitespace[9] = "#text"; expectedWithWhitespace[10] = "employeeId"; expectedWithWhitespace[11] = "#text"; let replacedChild; doc = staff.staff(); elementList = doc.getElementsByTagName("employee"); employeeNode = elementList.item(1); childList = employeeNode.childNodes; length = childList.length; if ( (length === 13) ) { newChild = childList.item(1); oldChild = childList.item(11); expected = expectedWithWhitespace; } else { newChild = childList.item(0); oldChild = childList.item(5); expected = expectedWithoutWhitespace; } replacedChild = employeeNode.replaceChild(newChild, oldChild); assert.equal(replacedChild, oldChild, "return_value_same"); for (let indexN100DE = 0; indexN100DE < childList.length; indexN100DE++) { childNode = childList.item(indexN100DE); childName = childNode.nodeName; actual[actual.length] = childName; } assert.deepEqual(actual, expected, "childNames"); }); /** * The "replaceChild(newChild,oldChild)" method raises a HIERARCHY_REQUEST_ERR DOMException if the node to put in is one of this node's ancestors. Retrieve the second employee and attempt to replace one of its children with an ancestor node(root node). An attempt to make such a replacement should raise the desired exception. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='HIERARCHY_REQUEST_ERR']) * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-785887307 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-785887307')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='HIERARCHY_REQUEST_ERR']) * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-785887307 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=249 */ specify("nodereplacechildnodeancestor", () => { let success; let doc; let newChild; let elementList; let employeeNode; let childList; let oldChild; let replacedNode; doc = staff.staff(); newChild = doc.documentElement; elementList = doc.getElementsByTagName("employee"); employeeNode = elementList.item(1); childList = employeeNode.childNodes; oldChild = childList.item(0); { success = false; try { replacedNode = employeeNode.replaceChild(newChild, oldChild); } catch (ex) { success = (typeof (ex.code) !== "undefined" && ex.code === 3); } assert.ok(success, "throw_HIERARCHY_REQUEST_ERR"); } }); /** * Replace the second Element of the second employee with a newly created node Element and check the NodeName returned by the "replaceChild(newChild,oldChild)" method. The returned node should have a NodeName equal to "employeeId". * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D095 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-785887307 */ specify("nodereplacechildnodename", () => { let success; let doc; let elementList; let employeeNode; let childList; let oldChild; let newChild; let replacedNode; let length; let childName; doc = staff.staff(); elementList = doc.getElementsByTagName("employee"); employeeNode = elementList.item(1); childList = employeeNode.childNodes; length = childList.length; oldChild = childList.item(1); newChild = doc.createElement("newChild"); replacedNode = employeeNode.replaceChild(newChild, oldChild); childName = replacedNode.nodeName; if ( (length === 6) ) { assert.equal(childName, "name", "nowhitespace"); } else { assert.equal(childName, "employeeId", "whitespace"); } }); /** * The "replaceChild(newChild,oldChild)" method raises a NOT_FOUND_ERR DOMException if the old child is not a child of this node. Retrieve the second employee and attempt to replace a node that is not one of its children. An attempt to replace such a node should raise the desired exception. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='NOT_FOUND_ERR']) * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-785887307 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-785887307')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NOT_FOUND_ERR']) * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-785887307 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=249 */ specify("nodereplacechildoldchildnonexistent", () => { let success; let doc; let oldChild; let newChild; let elementList; let elementNode; let replacedNode; doc = staff.staff(); newChild = doc.createElement("newChild"); oldChild = doc.createElement("oldChild"); elementList = doc.getElementsByTagName("employee"); elementNode = elementList.item(1); { success = false; try { replacedNode = elementNode.replaceChild(newChild, oldChild); } catch (ex) { success = (typeof (ex.code) !== "undefined" && ex.code === 8); } assert.ok(success, "throw_NOT_FOUND_ERR"); } }); /** * The "getAttributes()" method invoked on a Text Node returns null. Retrieve the Text node from the last child of the first employee and invoke the "getAttributes()" method on the Text Node. It should return null. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-84CF096 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1312295772 */ specify("nodetextnodeattribute", () => { let success; let doc; let elementList; let testAddr; let textNode; let attrList; doc = staff.staff(); elementList = doc.getElementsByTagName("address"); testAddr = elementList.item(0); textNode = testAddr.firstChild; attrList = textNode.attributes; assert.equal(attrList, null, "nodeTextNodeAttributesAssert1"); }); /** * The string returned by the "getNodeName()" method for a Text Node is "#text". Retrieve the Text Node from the last child of the first employee and check the string returned by the "getNodeName()" method. It should be equal to "#text". * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D095 */ specify("nodetextnodename", () => { let success; let doc; let elementList; let testAddr; let textNode; let textName; doc = staff.staff(); elementList = doc.getElementsByTagName("address"); testAddr = elementList.item(0); textNode = testAddr.firstChild; textName = textNode.nodeName; assert.equal(textName, "#text", "nodeTextNodeNameAssert1"); }); /** * The "getNodeType()" method for a Text Node returns the constant value 3. Retrieve the Text node from the last child of the first employee and invoke the "getNodeType()" method. The method should return 3. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-111237558 */ specify("nodetextnodetype", () => { let success; let doc; let elementList; let testAddr; let textNode; let nodeType; doc = staff.staff(); elementList = doc.getElementsByTagName("address"); testAddr = elementList.item(0); textNode = testAddr.firstChild; nodeType = textNode.nodeType; assert.equal(nodeType, 3, "nodeTextNodeTypeAssert1"); }); /** * The string returned by the "getNodeValue()" method for a Text Node is the content of the Text node. Retrieve the Text node from the last child of the first employee and check the string returned by the "getNodeValue()" method. It should be equal to "1230 North Ave. Dallas, Texas 98551". * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D080 */ specify("nodetextnodevalue", () => { let success; let doc; let elementList; let testAddr; let textNode; let textValue; doc = staff.staff(); elementList = doc.getElementsByTagName("address"); testAddr = elementList.item(0); textNode = testAddr.firstChild; textValue = textNode.nodeValue; assert.equal(textValue, "1230 North Ave. Dallas, Texas 98551", "nodeTextNodeValueAssert1"); }); /** * An element is created, setNodeValue is called with a non-null argument, but getNodeValue should still return null. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D080 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#i-Document */ specify("nodevalue01", () => { let success; let doc; let newNode; let newValue; doc = staff.staff(); newNode = doc.createElement("address"); newValue = newNode.nodeValue; assert.equal(newValue, null, "initiallyNull"); newNode.nodeValue = "This should have no effect"; newValue = newNode.nodeValue; assert.equal(newValue, null, "nullAfterAttemptedChange"); }); /** * An comment is created, setNodeValue is called with a non-null argument, but getNodeValue should still return null. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D080 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1728279322 */ specify("nodevalue02", () => { let success; let doc; let newNode; let newValue; doc = staff.staff(); newNode = doc.createComment("This is a new Comment node"); newValue = newNode.nodeValue; assert.equal(newValue, "This is a new Comment node", "initial"); newNode.nodeValue = "This should have an effect"; newValue = newNode.nodeValue; assert.equal(newValue, "This should have an effect", "afterChange"); }); /** * An document type accessed, setNodeValue is called with a non-null argument, but getNodeValue should still return null. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D080 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-B63ED1A31 */ specify("nodevalue04", () => { let success; let doc; let newNode; let newValue; doc = staff.staff(); newNode = doc.doctype; assert.notEqual(newNode, null, "docTypeNotNull"); newValue = newNode.nodeValue; assert.equal(newValue, null, "initiallyNull"); newNode.nodeValue = "This should have no effect"; newValue = newNode.nodeValue; assert.equal(newValue, null, "nullAfterAttemptedChange"); }); /** * A document fragment is created, setNodeValue is called with a non-null argument, but getNodeValue should still return null. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D080 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-B63ED1A3 */ specify("nodevalue05", () => { let success; let doc; let newNode; let newValue; doc = staff.staff(); newNode = doc.createDocumentFragment(); newValue = newNode.nodeValue; assert.equal(newValue, null, "initiallyNull"); newNode.nodeValue = "This should have no effect"; newValue = newNode.nodeValue; assert.equal(newValue, null, "nullAfterAttemptedChange"); }); /** * An document is accessed, setNodeValue is called with a non-null argument, but getNodeValue should still return null. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D080 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#i-Document */ specify("nodevalue06", () => { let success; let newNode; let newValue; newNode = staff.staff(); newValue = newNode.nodeValue; assert.equal(newValue, null, "initiallyNull"); newNode.nodeValue = "This should have no effect"; newValue = newNode.nodeValue; assert.equal(newValue, null, "nullAfterAttemptedChange"); }); /** * An processing instruction is created, setNodeValue is called with a non-null argument, but getNodeValue should still return null. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D080 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1004215813 */ specify("nodevalue09", () => { let success; let doc; let newNode; let newValue; doc = staff.staff(); newNode = doc.createProcessingInstruction("TARGET", "DATA"); newValue = newNode.nodeValue; assert.equal(newValue, "DATA", "initial"); newNode.nodeValue = "This should have an effect"; newValue = newNode.nodeValue; assert.equal(newValue, "This should have an effect", "after"); }); /** * The "getData()" method returns the content of the processing instruction. It starts at the first non white character following the target and ends at the character immediately preceding the "?>". Retrieve the ProcessingInstruction node located immediately after the prolog. Create a nodelist of the child nodes of this document. Invoke the "getData()" method on the first child in the list. This should return the content of the ProcessingInstruction. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-837822393 */ specify("processinginstructiongetdata", () => { let success; let doc; let childNodes; let piNode; let data; doc = staff.staff(); childNodes = doc.childNodes; piNode = childNodes.item(0); data = piNode.data; assert.equal(data, "PIDATA", "processinginstructionGetTargetAssert"); }); /** * The "getTarget()" method returns the target of the processing instruction. It is the first token following the markup that begins the processing instruction. Retrieve the ProcessingInstruction node located immediately after the prolog. Create a nodelist of the child nodes of this document. Invoke the "getTarget()" method on the first child in the list. This should return the target of the ProcessingInstruction. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1478689192 */ specify("processinginstructiongettarget", () => { let success; let doc; let childNodes; let piNode; let target; doc = staff.staff(); childNodes = doc.childNodes; piNode = childNodes.item(0); target = piNode.target; assert.equal(target, "TEST-STYLE", "processinginstructionGetTargetAssert"); }); /** * The "splitText(offset)" method raises an INDEX_SIZE_ERR DOMException if the specified offset is negative. Retrieve the textual data from the second child of the third employee and invoke the "splitText(offset)" method. The desired exception should be raised since the offset is a negative number. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INDEX_SIZE_ERR']) * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-38853C1D * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-38853C1D')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INDEX_SIZE_ERR']) */ specify("textindexsizeerrnegativeoffset", () => { let success; let doc; let elementList; let nameNode; let textNode; let splitNode; doc = staff.staff(); elementList = doc.getElementsByTagName("name"); nameNode = elementList.item(2); textNode = nameNode.firstChild; { success = false; try { splitNode = textNode.splitText(-69); } catch (ex) { success = (typeof (ex.code) !== "undefined" && ex.code === 1); } assert.ok(success, "throws_INDEX_SIZE_ERR"); } }); /** * The "splitText(offset)" method raises an INDEX_SIZE_ERR DOMException if the specified offset is greater than the number of characters in the Text node. Retrieve the textual data from the second child of the third employee and invoke the "splitText(offset)" method. The desired exception should be raised since the offset is a greater than the number of characters in the Text node. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INDEX_SIZE_ERR']) * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-38853C1D * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-38853C1D')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INDEX_SIZE_ERR']) * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=249 */ specify("textindexsizeerroffsetoutofbounds", () => { let success; let doc; let elementList; let nameNode; let textNode; let splitNode; doc = staff.staff(); elementList = doc.getElementsByTagName("name"); nameNode = elementList.item(2); textNode = nameNode.firstChild; { success = false; try { splitNode = textNode.splitText(300); } catch (ex) { success = (typeof (ex.code) !== "undefined" && ex.code === 1); } assert.ok(success, "throw_INDEX_SIZE_ERR"); } }); /** * The "splitText(offset)" method returns the new Text node. Retrieve the textual data from the last child of the first employee and invoke the "splitText(offset)" method. The method should return the new Text node. The offset value used for this test is 30. The "getNodeValue()" method is called to check that the new node now contains the characters at and after position 30. (Starting count at 0) * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-38853C1D */ specify("textsplittextfour", () => { let success; let doc; let elementList; let addressNode; let textNode; let splitNode; let value; doc = staff.staff(); elementList = doc.getElementsByTagName("address"); addressNode = elementList.item(0); textNode = addressNode.firstChild; splitNode = textNode.splitText(30); value = splitNode.nodeValue; assert.equal(value, "98551", "textSplitTextFourAssert"); }); /** * The "splitText(offset)" method breaks the Text node into two Text nodes at the specified offset keeping each node as siblings in the tree. Retrieve the textual data from the second child of the third employee and invoke the "splitText(offset)" method. The method splits the Text node into two new sibling Text nodes keeping both of them in the tree. This test checks the "nextSibling()" method of the original node to ensure that the two nodes are indeed siblings. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-38853C1D */ specify("textsplittextone", () => { let success; let doc; let elementList; let nameNode; let textNode; let splitNode; let secondPart; let value; doc = staff.staff(); elementList = doc.getElementsByTagName("name"); nameNode = elementList.item(2); textNode = nameNode.firstChild; splitNode = textNode.splitText(7); secondPart = textNode.nextSibling; value = secondPart.nodeValue; assert.equal(value, "Jones", "textSplitTextOneAssert"); }); /** * After the "splitText(offset)" method breaks the Text node into two Text nodes, the new Text node contains all the content at and after the offset point. Retrieve the textual data from the second child of the third employee and invoke the "splitText(offset)" method. The new Text node should contain all the content at and after the offset point. The "getNodeValue()" method is called to check that the new node now contains the characters at and after position seven. (Starting count at 0) * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-38853C1D */ specify("textsplittextthree", () => { let success; let doc; let elementList; let nameNode; let textNode; let splitNode; let value; doc = staff.staff(); elementList = doc.getElementsByTagName("name"); nameNode = elementList.item(2); textNode = nameNode.firstChild; splitNode = textNode.splitText(6); value = splitNode.nodeValue; assert.equal(value, " Jones", "textSplitTextThreeAssert"); }); /** * After the "splitText(offset)" method breaks the Text node into two Text nodes, the original node contains all the content up to the offset point. Retrieve the textual data from the second child of the third employee and invoke the "splitText(offset)" method. The original Text node should contain all the content up to the offset point. The "getNodeValue()" method is called to check that the original node now contains the first five characters. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-38853C1D */ specify("textsplittexttwo", () => { let success; let doc; let elementList; let nameNode; let textNode; let splitNode; let value; doc = staff.staff(); elementList = doc.getElementsByTagName("name"); nameNode = elementList.item(2); textNode = nameNode.firstChild; splitNode = textNode.splitText(5); value = textNode.nodeValue; assert.equal(value, "Roger", "textSplitTextTwoAssert"); }); /** * If there is not any markup inside an Element or Attr node content, then the text is contained in a single object implementing the Text interface that is the only child of the element. Retrieve the textual data from the second child of the third employee. That Text node contains a block of multiple text lines without markup, so they should be treated as a single Text node. The "getNodeValue()" method should contain the combination of the two lines. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1312295772 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D080 */ specify("textwithnomarkup", () => { let success; let doc; let elementList; let nameNode; let nodeV; let value; doc = staff.staff(); elementList = doc.getElementsByTagName("name"); nameNode = elementList.item(2); nodeV = nameNode.firstChild; value = nodeV.nodeValue; assert.equal(value, "Roger\n Jones", "textNodeValue"); }); /* splitText Breaks this Text node into two Text nodes at the specified offset, keeping both in the tree as siblings. This node then only contains all the content up to the offset point. And a new Text node, which is inserted as the next sibling of this node, contains all the content at and after the offset point This test ensures that the new text node is inserted at the correct location. This test does not actually test the splitText offsets and other behavior as that is handled in previous tests. */ specify("maintainsplittextlocation", () => { let doc; let children; let firstTextNode; doc = extra.extra(); children = doc.getElementsByTagName("splitTextTest").item(0).childNodes; firstTextNode = children.item(0); assert.equal(children.length, 2, "Original children count should be 2"); children.item(0).splitText("5"); assert.equal(children.length, 3, "After split, the children count should be 3"); assert.strictEqual( children.item(children.length - 1).nodeType, doc.ELEMENT_NODE, "After split, the last child should be an ELEMENT_NODE" ); assert.strictEqual( children.item(0), firstTextNode, "After split the first child should still be the same object as before" ); assert.strictEqual(children.item(1).nodeType, doc.TEXT_NODE, "After split the second child should be a text node"); }); specify("allow_empty_nodelists", () => { let doc = extra.extra(); let element = doc.createElement("test"); assert.strictEqual(element.children.length, 0); }); specify("creating_text_nodes_with_falsy_values", () => { let doc = extra.extra(); let txt1 = doc.createTextNode(0); assert.strictEqual(txt1.nodeValue, "0"); let txt2 = doc.createTextNode(false); assert.strictEqual(txt2.nodeValue, "false"); let txt3 = doc.createTextNode(null); assert.strictEqual(txt3.nodeValue, "null"); let txt4 = doc.createTextNode(NaN); assert.strictEqual(txt4.nodeValue, "NaN"); let txt5 = doc.createTextNode(undefined); assert.strictEqual(txt5.nodeValue, "undefined"); let txt7 = doc.createTextNode(""); assert.strictEqual(txt7.nodeValue, ""); }); }); jsdom-19.0.0/test/to-port-to-wpts/level1/core/000077500000000000000000000000001415223704400210355ustar00rootroot00000000000000jsdom-19.0.0/test/to-port-to-wpts/level1/core/files/000077500000000000000000000000001415223704400221375ustar00rootroot00000000000000jsdom-19.0.0/test/to-port-to-wpts/level1/core/files/extra.xml.js000066400000000000000000000006671415223704400244300ustar00rootroot00000000000000"use strict"; const { JSDOM } = require("../../../../.."); exports.extra = function() { var doc = (new JSDOM("", { contentType: "application/xml" })).window.document; var splitTextTest = doc.createElement("splitTextTest"); splitTextTest.appendChild(doc.createTextNode("Split me")); splitTextTest.appendChild(doc.createElement("last")); doc.documentElement.appendChild(splitTextTest); doc.normalize(); return doc; }; jsdom-19.0.0/test/to-port-to-wpts/level1/core/files/hc_nodtdstaff.xml.js000066400000000000000000000010061415223704400260770ustar00rootroot00000000000000"use strict"; const { JSDOM } = require("../../../../.."); exports.hc_nodtdstaff = function () { return (new JSDOM(` hc_nodtdstaff

EMP0001 Margaret Martin Accountant 56,000 Female 1230 North Ave. Dallas, Texas 98551

`, { contentType: "application/xml" })).window.document; }; jsdom-19.0.0/test/to-port-to-wpts/level1/core/files/hc_staff.xml.js000066400000000000000000000037361415223704400250620ustar00rootroot00000000000000"use strict"; const { JSDOM } = require("../../../../.."); exports.hc_staff = function () { return (new JSDOM(`\ ]> hc_staff

EMP0001 Margaret Martin Accountant 56,000 Female 1230 North Ave. Dallas, Texas 98551

EMP0002 Martha RaynoldsThis is a CDATASection with EntityReference number 2 &ent2; This is an adjacent CDATASection with a reference to a tab &tab; Secretary 35,000 Female β Dallas, γ 98554

EMP0003 Roger Jones Department Manager 100,000 δ PO Box 27 Irving, texas 98553

EMP0004 Jeny Oconnor Personnel Director 95,000 Female 27 South Road. Dallas, Texas 98556

EMP0005 Robert Myers Computer Specialist 90,000 male 1821 Nordic. Road, Irving Texas 98558

`, { contentType: "application/xml" })).window.document; }; jsdom-19.0.0/test/to-port-to-wpts/level1/core/files/staff.xml.js000066400000000000000000000045051415223704400244030ustar00rootroot00000000000000"use strict"; const { JSDOM } = require("../../../../.."); exports.staff = function () { // NB: removed "" from ent4 because it breaks htmlparser2 https://github.com/fb55/htmlparser2/issues/117 // NB: removed newline after because it breaks htmlparser2 https://github.com/fb55/htmlparser2/issues/118 return (new JSDOM(` Element data"> ]> EMP0001 Margaret Martin Accountant 56,000 Female
1230 North Ave. Dallas, Texas 98551
EMP0002 Martha Raynolds Secretary 35,000 Female
&ent2; Dallas, &ent3; 98554
EMP0003 Roger Jones Department Manager 100,000 &ent4;
PO Box 27 Irving, texas 98553
EMP0004 Jeny Oconnor Personnel Director 95,000 Female
27 South Road. Dallas, Texas 98556
EMP0005 Robert Myers Computer Specialist 90,000 male
1821 Nordic. Road, Irving Texas 98558
`, { contentType: "application/xml" })).window.document; }; jsdom-19.0.0/test/to-port-to-wpts/level1/html.js000066400000000000000000005645741415223704400214340ustar00rootroot00000000000000"use strict"; const { assert } = require("chai"); const { describe, specify } = require("mocha-sugar-free"); const hc_staff = require("./html/files/hc_staff.html"); describe("level1/html", () => { /** * The "getDoctype()" method returns null for XML documents without a document type declaration. Retrieve the XML document without a DTD and invoke the "getDoctype()" method. It should return null. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-B63ED1A31 */ specify("documentgetdoctypenodtd", () => { let doc = require("./html/files/hc_nodtdstaff.html").hc_nodtdstaff(); assert.equal(doc.doctype, null, "documentGetDocTypeNoDTDAssert"); }); /** * Create a new DocumentFragment and add a newly created Element node(with one attribute). Once the element is added, its attribute should be available as an attribute associated with an Element within a DocumentFragment. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-35CB04B5 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68F082 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-B63ED1A3 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=236 * @see http://lists.w3.org/Archives/Public/www-dom-ts/2003Jun/0011.html * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=184 */ specify("hc_attrcreatedocumentfragment", () => { let langAttrCount = 0; let doc = hc_staff.hc_staff(); let docFragment = doc.createDocumentFragment(); let newOne = doc.createElement("html"); newOne.setAttribute("lang", "EN"); docFragment.appendChild(newOne); let attributes = docFragment.firstChild.attributes; for (let i = 0; i < attributes.length; i++) { let attribute = attributes.item(i); let attrName = attribute.name; if (attrName === "lang") { langAttrCount += 1; } } assert.equal(langAttrCount, 1, "hasLangAttr"); }); /** * The "setValue()" method for an attribute creates a Text node with the unparsed content of the string. Retrieve the attribute named "class" from the last child of of the fourth employee and assign the "Y&ent1;" string to its value attribute. This value is not yet parsed and therefore should still be the same upon retrieval. This test uses the "getNamedItem(name)" method from the NamedNodeMap interface. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-221662474 * @see http://lists.w3.org/Archives/Public/www-dom-ts/2002Apr/0057.html */ specify("hc_attrcreatetextnode", () => { let success; let doc; let addressList; let testNode; let attributes; let streetAttr; let value; doc = hc_staff.hc_staff(); addressList = doc.getElementsByTagName("acronym"); testNode = addressList.item(3); attributes = testNode.attributes; streetAttr = attributes.getNamedItem("class"); streetAttr.value = "Y&ent1;"; value = streetAttr.value; assert.equal(value, "Y&ent1;", "value"); value = streetAttr.nodeValue; assert.equal(value, "Y&ent1;", "nodeValue"); }); /** * The "setNodeValue()" method for an attribute creates a Text node with the unparsed content of the string. Retrieve the attribute named "class" from the last child of of the fourth employee and assign the "Y&ent1;" string to its value attribute. This value is not yet parsed and therefore should still be the same upon retrieval. This test uses the "getNamedItem(name)" method from the NamedNodeMap interface. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D080 * @see http://lists.w3.org/Archives/Public/www-dom-ts/2002Apr/0057.html */ specify("hc_attrcreatetextnode2", () => { let success; let doc; let addressList; let testNode; let attributes; let streetAttr; let value; doc = hc_staff.hc_staff(); addressList = doc.getElementsByTagName("acronym"); testNode = addressList.item(3); attributes = testNode.attributes; streetAttr = attributes.getNamedItem("class"); streetAttr.nodeValue = "Y&ent1;"; value = streetAttr.value; assert.equal(value, "Y&ent1;", "value"); value = streetAttr.nodeValue; assert.equal(value, "Y&ent1;", "nodeValue"); }); /** * If an Attr is explicitly assigned any value, then that value is the attributes effective value. Retrieve the attribute named "domestic" from the last child of of the first employee and examine its nodeValue attribute. This test uses the "getNamedItem(name)" method from the NamedNodeMap interface. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-84CF096 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1074577549 */ specify("hc_attreffectivevalue", () => { let success; let doc; let addressList; let testNode; let attributes; let domesticAttr; let value; doc = hc_staff.hc_staff(); addressList = doc.getElementsByTagName("acronym"); testNode = addressList.item(0); attributes = testNode.attributes; domesticAttr = attributes.getNamedItem("title"); value = domesticAttr.nodeValue; assert.equal(value, "Yes", "attrEffectiveValueAssert"); }); /** * Checks the value of an attribute that contains entity references. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-221662474 */ specify("hc_attrgetvalue1", () => { let success; let doc; let acronymList; let testNode; let attributes; let titleAttr; let value; let textNode; let retval; let lastChild; doc = hc_staff.hc_staff(); acronymList = doc.getElementsByTagName("acronym"); testNode = acronymList.item(3); attributes = testNode.attributes; titleAttr = attributes.getNamedItem("class"); value = titleAttr.value; assert.equal(value, "Yα", "attrValue1"); }); /** * Retrieve the attribute named class from the last child of of the second "p" element and examine its NodeName. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D095 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1112119403 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=236 * @see http://lists.w3.org/Archives/Public/www-dom-ts/2003Jun/0011.html */ specify("hc_attrname", () => { let doc = hc_staff.hc_staff(); let streetAttr = doc.getElementsByTagName("acronym").item(1).attributes.getNamedItem("class"); assert.equal(streetAttr.name, "class", "attribute name"); }); /** * The "getSpecified()" method for an Attr node should be set to true if the attribute was explicitly given a value. Retrieve the attribute named "domestic" from the last child of of the first employee and examine the value returned by the "getSpecified()" method. This test uses the "getNamedItem(name)" method from the NamedNodeMap interface. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-862529273 */ specify("hc_attrspecifiedvalue", () => { let success; let doc; let addressList; let testNode; let attributes; let domesticAttr; let state; doc = hc_staff.hc_staff(); addressList = doc.getElementsByTagName("acronym"); testNode = addressList.item(0); attributes = testNode.attributes; domesticAttr = attributes.getNamedItem("title"); state = domesticAttr.specified; assert.ok(state, "acronymTitleSpecified"); }); /** * The "getSpecified()" method for an Attr node should return true if the value of the attribute is changed. Retrieve the attribute named "class" from the last child of of the THIRD employee and change its value to "Yes"(which is the default DTD value). This should cause the "getSpecified()" method to be true. This test uses the "setAttribute(name,value)" method from the Element interface and the "getNamedItem(name)" method from the NamedNodeMap interface. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-862529273 */ specify("hc_attrspecifiedvaluechanged", () => { let success; let doc; let addressList; let testNode; let attributes; let streetAttr; let state; doc = hc_staff.hc_staff(); addressList = doc.getElementsByTagName("acronym"); testNode = addressList.item(2); testNode.setAttribute("class", "Yα"); attributes = testNode.attributes; streetAttr = attributes.getNamedItem("class"); state = streetAttr.specified; assert.ok(state, "acronymClassSpecified"); }); /** * The "appendData(arg)" method appends a string to the end of the character data of the node. Retrieve the character data from the second child of the first employee. The appendData(arg) method is called with arg=", Esquire". The method should append the specified data to the already existing character data. The new value return by the "getLength()" method should be 24. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-32791A2F */ specify("hc_characterdataappenddata", () => { let success; let doc; let elementList; let nameNode; let child; let childValue; let childLength; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("strong"); nameNode = elementList.item(0); child = nameNode.firstChild; child.appendData(", Esquire"); childValue = child.data; childLength = childValue.length; assert.equal(childLength, 24, "characterdataAppendDataAssert"); }); /** * On successful invocation of the "appendData(arg)" method the "getData()" method provides access to the concatentation of data and the specified string. Retrieve the character data from the second child of the first employee. The appendData(arg) method is called with arg=", Esquire". The method should append the specified data to the already existing character data. The new value return by the "getData()" method should be "Margaret Martin, Esquire". * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-32791A2F */ specify("hc_characterdataappenddatagetdata", () => { let success; let doc; let elementList; let nameNode; let child; let childData; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("strong"); nameNode = elementList.item(0); child = nameNode.firstChild; child.appendData(", Esquire"); childData = child.data; assert.equal(childData, "Margaret Martin, Esquire", "characterdataAppendDataGetDataAssert"); }); /** * The "deleteData(offset,count)" method removes a range of characters from the node. Delete data at the beginning of the character data. Retrieve the character data from the last child of the first employee. The "deleteData(offset,count)" method is then called with offset=0 and count=16. The method should delete the characters from position 0 thru position 16. The new value of the character data should be "Dallas, Texas 98551". * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-7C603781 */ specify("hc_characterdatadeletedatabegining", () => { let success; let doc; let elementList; let nameNode; let child; let childData; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("acronym"); nameNode = elementList.item(0); child = nameNode.firstChild; child.deleteData(0, 16); childData = child.data; assert.equal(childData, "Dallas, Texas 98551", "data"); }); /** * The "deleteData(offset,count)" method removes a range of characters from the node. Delete data at the end of the character data. Retrieve the character data from the last child of the first employee. The "deleteData(offset,count)" method is then called with offset=30 and count=5. The method should delete the characters from position 30 thru position 35. The new value of the character data should be "1230 North Ave. Dallas, Texas". * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-7C603781 */ specify("hc_characterdatadeletedataend", () => { let success; let doc; let elementList; let nameNode; let child; let childData; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("acronym"); nameNode = elementList.item(0); child = nameNode.firstChild; child.deleteData(30, 5); childData = child.data; assert.equal(childData, "1230 North Ave. Dallas, Texas ", "characterdataDeleteDataEndAssert"); }); /** * If the sum of the offset and count used in the "deleteData(offset,count) method is greater than the length of the character data then all the characters from the offset to the end of the data are deleted. Retrieve the character data from the last child of the first employee. The "deleteData(offset,count)" method is then called with offset=4 and count=50. The method should delete the characters from position 4 to the end of the data since the offset+count(50+4) is greater than the length of the character data(35). The new value of the character data should be "1230". * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-7C603781 */ specify("hc_characterdatadeletedataexceedslength", () => { let success; let doc; let elementList; let nameNode; let child; let childData; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("acronym"); nameNode = elementList.item(0); child = nameNode.firstChild; child.deleteData(4, 50); childData = child.data; assert.equal(childData, "1230", "characterdataDeleteDataExceedsLengthAssert"); }); /** * On successful invocation of the "deleteData(offset,count)" method, the "getData()" and "getLength()" methods reflect the changes. Retrieve the character data from the last child of the first employee. The "deleteData(offset,count)" method is then called with offset=30 and count=5. The method should delete the characters from position 30 thru position 35. The new value of the character data should be "1230 North Ave. Dallas, Texas" which is returned by the "getData()" method and "getLength()" method should return 30". * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-7D61178C * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-7C603781 */ specify("hc_characterdatadeletedatagetlengthanddata", () => { let success; let doc; let elementList; let nameNode; let child; let childData; let childLength; let result = new Array(); doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("acronym"); nameNode = elementList.item(0); child = nameNode.firstChild; child.deleteData(30, 5); childData = child.data; assert.equal(childData, "1230 North Ave. Dallas, Texas ", "data"); childLength = child.length; assert.equal(childLength, 30, "length"); }); /** * The "deleteData(offset,count)" method removes a range of characters from the node. Delete data in the middle of the character data. Retrieve the character data from the last child of the first employee. The "deleteData(offset,count)" method is then called with offset=16 and count=8. The method should delete the characters from position 16 thru position 24. The new value of the character data should be "1230 North Ave. Texas 98551". * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-7C603781 */ specify("hc_characterdatadeletedatamiddle", () => { let success; let doc; let elementList; let nameNode; let child; let childData; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("acronym"); nameNode = elementList.item(0); child = nameNode.firstChild; child.deleteData(16, 8); childData = child.data; assert.equal(childData, "1230 North Ave. Texas 98551", "characterdataDeleteDataMiddleAssert"); }); /** * The "getData()" method retrieves the character data currently stored in the node. Retrieve the character data from the second child of the first employee and invoke the "getData()" method. The method returns the character data string. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359 */ specify("hc_characterdatagetdata", () => { let success; let doc; let elementList; let nameNode; let child; let childData; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("strong"); nameNode = elementList.item(0); child = nameNode.firstChild; childData = child.data; assert.equal(childData, "Margaret Martin", "characterdataGetDataAssert"); }); /** * The "getLength()" method returns the number of characters stored in this nodes data. Retrieve the character data from the second child of the first employee and examine the value returned by the getLength() method. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-7D61178C */ specify("hc_characterdatagetlength", () => { let success; let doc; let elementList; let nameNode; let child; let childValue; let childLength; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("strong"); nameNode = elementList.item(0); child = nameNode.firstChild; childValue = child.data; childLength = childValue.length; assert.equal(childLength, 15, "characterdataGetLengthAssert"); }); /** * The "deleteData(offset,count)" method works if the specified count is negative. Retrieve the character data of the last child of the first employee and invoke its "deleteData(offset,count)" method with offset=10 and count=-3. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INDEX_SIZE_ERR']) * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-6531BCCF * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-6531BCCF')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INDEX_SIZE_ERR']) */ specify("hc_characterdataindexsizeerrdeletedatacountnegative", () => { let doc = hc_staff.hc_staff(); let child = doc.getElementsByTagName("acronym").item(0).firstChild; let success = false; assert.equal(child.substringData(10, -3), " Ave. Dallas, Texas 98551"); }); /** * The "deleteData(offset,count)" method raises an INDEX_SIZE_ERR DOMException if the specified offset is greater that the number of characters in the string. Retrieve the character data of the last child of the first employee and invoke its "deleteData(offset,count)" method with offset=40 and count=3. It should raise the desired exception since the offset is greater than the number of characters in the string. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INDEX_SIZE_ERR']) * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-7C603781 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-7C603781')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INDEX_SIZE_ERR']) * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-7C603781 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=249 */ specify("hc_characterdataindexsizeerrdeletedataoffsetgreater", () => { let doc = hc_staff.hc_staff(); let child = doc.getElementsByTagName("acronym").item(0).firstChild; let success = false; try { child.deleteData(40, 3); } catch (ex) { success = (typeof (ex.code) !== "undefined" && ex.code === 1); } assert.ok(success, "throw_INDEX_SIZE_ERR"); }); /** * The "deleteData(offset,count)" method raises an INDEX_SIZE_ERR DOMException if the specified offset is negative. Retrieve the character data of the last child of the first employee and invoke its "deleteData(offset,count)" method with offset=-5 and count=3. It should raise the desired exception since the offset is negative. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INDEX_SIZE_ERR']) * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-7C603781 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-7C603781')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INDEX_SIZE_ERR']) * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-7C603781 */ specify("hc_characterdataindexsizeerrdeletedataoffsetnegative", () => { let doc = hc_staff.hc_staff(); let child = doc.getElementsByTagName("acronym").item(0).firstChild; let success = false; try { child.deleteData(-5, 3); } catch (ex) { success = (typeof (ex.code) !== "undefined" && ex.code === 1); } assert.ok(success, "throws_INDEX_SIZE_ERR"); }); /** * The "insertData(offset,arg)" method raises an INDEX_SIZE_ERR DOMException if the specified offset is greater than the number of characters in the string. Retrieve the character data of the last child of the first employee and invoke its insertData"(offset,arg)" method with offset=40 and arg="ABC". It should raise the desired exception since the offset is greater than the number of characters in the string. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INDEX_SIZE_ERR']) * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-7C603781 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-7C603781')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INDEX_SIZE_ERR']) * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=249 */ specify("hc_characterdataindexsizeerrinsertdataoffsetgreater", () => { let doc = hc_staff.hc_staff(); let child = doc.getElementsByTagName("acronym").item(0).firstChild; let success = false; try { child.deleteData(40, 3); } catch (ex) { success = (typeof (ex.code) !== "undefined" && ex.code === 1); } assert.ok(success, "throw_INDEX_SIZE_ERR"); }); /** * The "insertData(offset,arg)" method raises an INDEX_SIZE_ERR DOMException if the specified offset is negative. Retrieve the character data of the last child of the first employee and invoke its insertData"(offset,arg)" method with offset=-5 and arg="ABC". It should raise the desired exception since the offset is negative. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INDEX_SIZE_ERR']) * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-E5CBA7FB * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-E5CBA7FB')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INDEX_SIZE_ERR']) */ specify("hc_characterdataindexsizeerrinsertdataoffsetnegative", () => { let doc = hc_staff.hc_staff(); let child = doc.getElementsByTagName("acronym").item(0).firstChild; let success = false; try { child.replaceData(-5, 3, "ABC"); } catch (ex) { success = (typeof (ex.code) !== "undefined" && ex.code === 1); } assert.ok(success, "throws_INDEX_SIZE_ERR"); }); /** * The "substringData(offset,count)" method works if the specified count is negative. Retrieve the character data of the last child of the first employee and invoke its "replaceData(offset,count,arg) method with offset=10 and count=-3 and arg="ABC". * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INDEX_SIZE_ERR']) * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-6531BCCF * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-6531BCCF')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INDEX_SIZE_ERR']) */ specify("hc_characterdataindexsizeerrreplacedatacountnegative", () => { let doc = hc_staff.hc_staff(); let child = doc.getElementsByTagName("acronym").item(0).firstChild; assert.equal(child.substringData(10, -3), " Ave. Dallas, Texas 98551"); }); /** * The "replaceData(offset,count,arg)" method raises an INDEX_SIZE_ERR DOMException if the specified offset is greater than the length of the string. Retrieve the character data of the last child of the first employee and invoke its "replaceData(offset,count,arg) method with offset=40 and count=3 and arg="ABC". It should raise the desired exception since the offset is greater than the length of the string. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INDEX_SIZE_ERR']) * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-7C603781 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-7C603781')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INDEX_SIZE_ERR']) * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=242 */ specify("hc_characterdataindexsizeerrreplacedataoffsetgreater", () => { let doc = hc_staff.hc_staff(); let child = doc.getElementsByTagName("acronym").item(0).firstChild; let success = false; try { child.deleteData(40, 3); } catch (ex) { success = (typeof (ex.code) !== "undefined" && ex.code === 1); } assert.ok(success, "throw_INDEX_SIZE_ERR"); }); /** * The "replaceData(offset,count,arg)" method raises an INDEX_SIZE_ERR DOMException if the specified offset is negative. Retrieve the character data of the last child of the first employee and invoke its "replaceData(offset,count,arg) method with offset=-5 and count=3 and arg="ABC". It should raise the desired exception since the offset is negative. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INDEX_SIZE_ERR']) * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-E5CBA7FB * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-E5CBA7FB')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INDEX_SIZE_ERR']) * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-E5CBA7FB */ specify("hc_characterdataindexsizeerrreplacedataoffsetnegative", () => { let doc = hc_staff.hc_staff(); let child = doc.getElementsByTagName("acronym").item(0).firstChild; assert.equal(child.substringData(10, -3), " Ave. Dallas, Texas 98551"); let success = false; try { child.replaceData(-5, 3, "ABC"); } catch (ex) { success = (typeof (ex.code) !== "undefined" && ex.code === 1); } assert.ok(success, "throws_INDEX_SIZE_ERR"); }); /** * The "substringData(offset,count)" method raises an INDEX_SIZE_ERR DOMException if the specified offset is negative. Retrieve the character data of the last child of the first employee and invoke its "substringData(offset,count) method with offset=-5 and count=3. It should raise the desired exception since the offset is negative. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INDEX_SIZE_ERR']) * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-6531BCCF * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-6531BCCF')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INDEX_SIZE_ERR']) */ specify("hc_characterdataindexsizeerrsubstringnegativeoffset", () => { let doc = hc_staff.hc_staff(); let child = doc.getElementsByTagName("acronym").item(0).firstChild; let success = false; try { child.substringData(-5, 3); } catch (ex) { success = (typeof (ex.code) !== "undefined" && ex.code === 1); } assert.ok(success, "throws_INDEX_SIZE_ERR"); }); /** * The "substringData(offset,count)" method raises an INDEX_SIZE_ERR DOMException if the specified offset is greater than the number of characters in the string. Retrieve the character data of the last child of the first employee and invoke its "substringData(offset,count) method with offset=40 and count=3. It should raise the desired exception since the offsets value is greater than the length. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INDEX_SIZE_ERR']) * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-6531BCCF * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-6531BCCF')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INDEX_SIZE_ERR']) * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=249 */ specify("hc_characterdataindexsizeerrsubstringoffsetgreater", () => { let doc = hc_staff.hc_staff(); let child = doc.getElementsByTagName("acronym").item(0).firstChild; let success = false; try { child.substringData(40, 3); } catch (ex) { success = (typeof (ex.code) !== "undefined" && ex.code === 1); } assert.ok(success, "throw_INDEX_SIZE_ERR"); }); /** * The "insertData(offset,arg)" method will insert a string at the specified character offset. Insert the data at the beginning of the character data. Retrieve the character data from the second child of the first employee. The "insertData(offset,arg)" method is then called with offset=0 and arg="Mss.". The method should insert the string "Mss." at position 0. The new value of the character data should be "Mss. Margaret Martin". * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-3EDB695F */ specify("hc_characterdatainsertdatabeginning", () => { let success; let doc; let elementList; let nameNode; let child; let childData; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("strong"); nameNode = elementList.item(0); child = nameNode.firstChild; child.insertData(0, "Mss. "); childData = child.data; assert.equal(childData, "Mss. Margaret Martin", "characterdataInsertDataBeginningAssert"); }); /** * The "insertData(offset,arg)" method will insert a string at the specified character offset. Insert the data at the end of the character data. Retrieve the character data from the second child of the first employee. The "insertData(offset,arg)" method is then called with offset=15 and arg=", Esquire". The method should insert the string ", Esquire" at position 15. The new value of the character data should be "Margaret Martin, Esquire". * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-3EDB695F */ specify("hc_characterdatainsertdataend", () => { let success; let doc; let elementList; let nameNode; let child; let childData; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("strong"); nameNode = elementList.item(0); child = nameNode.firstChild; child.insertData(15, ", Esquire"); childData = child.data; assert.equal(childData, "Margaret Martin, Esquire", "characterdataInsertDataEndAssert"); }); /** * The "insertData(offset,arg)" method will insert a string at the specified character offset. Insert the data in the middle of the character data. Retrieve the character data from the second child of the first employee. The "insertData(offset,arg)" method is then called with offset=9 and arg="Ann". The method should insert the string "Ann" at position 9. The new value of the character data should be "Margaret Ann Martin". * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-3EDB695F */ specify("hc_characterdatainsertdatamiddle", () => { let success; let doc; let elementList; let nameNode; let child; let childData; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("strong"); nameNode = elementList.item(0); child = nameNode.firstChild; child.insertData(9, "Ann "); childData = child.data; assert.equal(childData, "Margaret Ann Martin", "characterdataInsertDataMiddleAssert"); }); /** * The "replaceData(offset,count,arg)" method replaces the characters starting at the specified offset with the specified string. Test for replacement in the middle of the data. Retrieve the character data from the last child of the first employee. The "replaceData(offset,count,arg)" method is then called with offset=5 and count=5 and arg="South". The method should replace characters five thru 9 of the character data with "South". * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-E5CBA7FB */ specify("hc_characterdatareplacedatabegining", () => { let success; let doc; let elementList; let nameNode; let child; let childData; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("acronym"); nameNode = elementList.item(0); child = nameNode.firstChild; child.replaceData(0, 4, "2500"); childData = child.data; assert.equal(childData, "2500 North Ave. Dallas, Texas 98551", "characterdataReplaceDataBeginingAssert"); }); /** * The "replaceData(offset,count,arg)" method replaces the characters starting at the specified offset with the specified string. Test for replacement at the end of the data. Retrieve the character data from the last child of the first employee. The "replaceData(offset,count,arg)" method is then called with offset=30 and count=5 and arg="98665". The method should replace characters 30 thru 34 of the character data with "98665". * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-E5CBA7FB */ specify("hc_characterdatareplacedataend", () => { let success; let doc; let elementList; let nameNode; let child; let childData; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("acronym"); nameNode = elementList.item(0); child = nameNode.firstChild; child.replaceData(30, 5, "98665"); childData = child.data; assert.equal(childData, "1230 North Ave. Dallas, Texas 98665", "characterdataReplaceDataEndAssert"); }); /** * The "replaceData(offset,count,arg)" method replaces the characters starting at the specified offset with the specified string. Test the situation where the length of the arg string is greater than the specified offset. Retrieve the character data from the last child of the first employee. The "replaceData(offset,count,arg)" method is then called with offset=0 and count=4 and arg="260030". The method should replace characters one thru four with "260030". Note that the length of the specified string is greater that the specified offset. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-E5CBA7FB */ specify("hc_characterdatareplacedataexceedslengthofarg", () => { let success; let doc; let elementList; let nameNode; let child; let childData; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("acronym"); nameNode = elementList.item(0); child = nameNode.firstChild; child.replaceData(0, 4, "260030"); childData = child.data; assert.equal( childData, "260030 North Ave. Dallas, Texas 98551", "characterdataReplaceDataExceedsLengthOfArgAssert" ); }); /** * If the sum of the offset and count exceeds the length then all the characters to the end of the data are replaced. Retrieve the character data from the last child of the first employee. The "replaceData(offset,count,arg)" method is then called with offset=0 and count=50 and arg="2600". The method should replace all the characters with "2600". This is because the sum of the offset and count exceeds the length of the character data. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-E5CBA7FB */ specify("hc_characterdatareplacedataexceedslengthofdata", () => { let success; let doc; let elementList; let nameNode; let child; let childData; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("acronym"); nameNode = elementList.item(0); child = nameNode.firstChild; child.replaceData(0, 50, "2600"); childData = child.data; assert.equal(childData, "2600", "characterdataReplaceDataExceedsLengthOfDataAssert"); }); /** * The "replaceData(offset,count,arg)" method replaces the characters starting at the specified offset with the specified string. Test for replacement in the middle of the data. Retrieve the character data from the last child of the first employee. The "replaceData(offset,count,arg)" method is then called with offset=5 and count=5 and arg="South". The method should replace characters five thru 9 of the character data with "South". * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-E5CBA7FB */ specify("hc_characterdatareplacedatamiddle", () => { let success; let doc; let elementList; let nameNode; let child; let childData; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("acronym"); nameNode = elementList.item(0); child = nameNode.firstChild; child.replaceData(5, 5, "South"); childData = child.data; assert.equal(childData, "1230 South Ave. Dallas, Texas 98551", "characterdataReplaceDataMiddleAssert"); }); /** * The "setNodeValue()" method changes the character data currently stored in the node. Retrieve the character data from the second child of the first employee and invoke the "setNodeValue()" method, call "getData()" and compare. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359 */ specify("hc_characterdatasetnodevalue", () => { let success; let doc; let elementList; let nameNode; let child; let childData; let childValue; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("strong"); nameNode = elementList.item(0); child = nameNode.firstChild; child.nodeValue = "Marilyn Martin"; childData = child.data; assert.equal(childData, "Marilyn Martin", "data"); childValue = child.nodeValue; assert.equal(childValue, "Marilyn Martin", "value"); }); /** * If the sum of the "offset" and "count" exceeds the "length" then the "substringData(offset,count)" method returns all the characters to the end of the data. Retrieve the character data from the second child of the first employee and access part of the data by using the substringData(offset,count) method with offset=9 and count=10. The method should return the substring "Martin" since offset+count > length (19 > 15). * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-6531BCCF */ specify("hc_characterdatasubstringexceedsvalue", () => { let success; let doc; let elementList; let nameNode; let child; let substring; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("strong"); nameNode = elementList.item(0); child = nameNode.firstChild; substring = child.substringData(9, 10); assert.equal(substring, "Martin", "characterdataSubStringExceedsValueAssert"); }); /** * The "substringData(offset,count)" method returns the specified string. Retrieve the character data from the second child of the first employee and access part of the data by using the substringData(offset,count) method. The method should return the specified substring starting at position "offset" and extract "count" characters. The method should return the string "Margaret". * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-6531BCCF */ specify("hc_characterdatasubstringvalue", () => { let success; let doc; let elementList; let nameNode; let child; let substring; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("strong"); nameNode = elementList.item(0); child = nameNode.firstChild; substring = child.substringData(0, 8); assert.equal(substring, "Margaret", "characterdataSubStringValueAssert"); }); /** * A comment is all the characters between the starting '' Retrieve the nodes of the DOM document. Search for a comment node and the content is its value. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1334481328 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D095 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D080 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-111237558 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-111237558 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=509 */ specify("hc_commentgetcomment", () => { let success; let doc; let elementList; let child; let childName; let childValue; let commentCount = 0; let childType; let attributes; doc = hc_staff.hc_staff(); elementList = doc.childNodes; for (let indexN1005E = 0; indexN1005E < elementList.length; indexN1005E++) { child = elementList.item(indexN1005E); childType = child.nodeType; if ( (childType === 8) ) { childName = child.nodeName; assert.equal(childName, "#comment", "nodeName"); childValue = child.nodeValue; assert.equal(childValue, " This is comment number 1.", "nodeValue"); attributes = child.attributes; assert.equal(attributes, null, "attributes"); commentCount += 1; } } assert.ok(commentCount < 2, "atMostOneComment"); }); /** * Retrieve the entire DOM document and invoke its "createAttribute(name)" method. It should create a new Attribute node with the given name. The name, value and type of the newly created object are retrieved and output. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1084891198 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=236 * @see http://lists.w3.org/Archives/Public/www-dom-ts/2003Jun/0011.html * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=243 */ specify("hc_documentcreateattribute", () => { let doc = hc_staff.hc_staff(); let newAttrNode = doc.createAttribute("title"); assert.equal(newAttrNode.nodeValue, "", "value"); assert.equal(newAttrNode.name, "title", "attribute name"); }); /** * The "createComment(data)" method creates a new Comment node given the specified string. Retrieve the entire DOM document and invoke its "createComment(data)" method. It should create a new Comment node whose "data" is the specified string. The content, name and type are retrieved and output. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1334481328 */ specify("hc_documentcreatecomment", () => { let success; let doc; let newCommentNode; let newCommentValue; let newCommentName; let newCommentType; doc = hc_staff.hc_staff(); newCommentNode = doc.createComment("This is a new Comment node"); newCommentValue = newCommentNode.nodeValue; assert.equal(newCommentValue, "This is a new Comment node", "value"); newCommentName = newCommentNode.nodeName; assert.equal(newCommentName, "#comment", "strong"); newCommentType = newCommentNode.nodeType; assert.equal(newCommentType, 8, "type"); }); /** * The "createDocumentFragment()" method creates an empty DocumentFragment object. Retrieve the entire DOM document and invoke its "createDocumentFragment()" method. The content, name, type and value of the newly created object are output. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-35CB04B5 */ specify("hc_documentcreatedocumentfragment", () => { let doc = hc_staff.hc_staff(); let newDocFragment = doc.createDocumentFragment(); assert.equal(newDocFragment.childNodes.length, 0, "length"); assert.equal(newDocFragment.nodeName, "#document-fragment", "strong"); assert.equal(newDocFragment.nodeType, 11, "type"); assert.equal(newDocFragment.nodeValue, null, "value"); }); /** * The "createElement(tagName)" method creates an Element of the type specified. Retrieve the entire DOM document and invoke its "createElement(tagName)" method with tagName="acronym". The method should create an instance of an Element node whose tagName is "acronym". The NodeName, NodeType and NodeValue are returned. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-2141741547 */ specify("hc_documentcreateelement", () => { let doc = hc_staff.hc_staff(); let newElement = doc.createElement("acronym"); assert.equal(newElement.nodeName, "ACRONYM", "element strong"); assert.equal(newElement.nodeType, 1, "type"); assert.equal(newElement.nodeValue, null, "valueInitiallyNull"); }); /** * The tagName parameter in the "createElement(tagName)" method is case-sensitive for XML documents. Retrieve the entire DOM document and invoke its "createElement(tagName)" method twice. Once for tagName equal to "acronym" and once for tagName equal to "ACRONYM" Each call should create a distinct Element node. The newly created Elements are then assigned attributes that are retrieved. Modified on 27 June 2003 to avoid setting an invalid style values and checked the node names to see if they matched expectations. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-2141741547 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=243 */ specify("hc_documentcreateelementcasesensitive", () => { let doc = hc_staff.hc_staff(); let newElement1 = doc.createElement("ACRONYM"); let newElement2 = doc.createElement("acronym"); newElement1.setAttribute("lang", "EN"); newElement2.setAttribute("title", "Dallas"); assert.equal(newElement1.getAttribute("lang"), "EN", "attrib1"); assert.equal(newElement2.getAttribute("title"), "Dallas", "attrib2"); assert.equal(newElement1.nodeName, "ACRONYM", "element nodeName1"); assert.equal(newElement2.nodeName, "ACRONYM", "element nodeName2"); }); /** * The "createTextNode(data)" method creates a Text node given the specfied string. Retrieve the entire DOM document and invoke its "createTextNode(data)" method. It should create a new Text node whose "data" is the specified string. The NodeName and NodeType are also checked. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1975348127 */ specify("hc_documentcreatetextnode", () => { let success; let doc; let newTextNode; let newTextName; let newTextValue; let newTextType; doc = hc_staff.hc_staff(); newTextNode = doc.createTextNode("This is a new Text node"); newTextValue = newTextNode.nodeValue; assert.equal(newTextValue, "This is a new Text node", "value"); newTextName = newTextNode.nodeName; assert.equal(newTextName, "#text", "strong"); newTextType = newTextNode.nodeType; assert.equal(newTextType, 3, "type"); }); /** * Access Document.doctype for hc_staff, if not text/html should return DocumentType node. HTML implementations may return null. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-B63ED1A31 */ specify("hc_documentgetdoctype", () => { let doc = hc_staff.hc_staff(); let docType = doc.doctype; assert.equal(docType.name, "html", "nodeName"); assert.equal(docType.nodeValue, null, "nodeValue"); assert.equal(docType.attributes, null, "attributes"); }); /** * The "getElementsByTagName(tagName)" method returns a NodeList of all the Elements with a given tagName. Retrieve the entire DOM document and invoke its "getElementsByTagName(tagName)" method with tagName equal to "strong". The method should return a NodeList that contains 5 elements. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-A6C9094 */ specify("hc_documentgetelementsbytagnamelength", () => { let success; let doc; let nameList; doc = hc_staff.hc_staff(); nameList = doc.getElementsByTagName("strong"); assert.equal(nameList.length, 5, "documentGetElementsByTagNameLengthAssert"); }); /** * Retrieve the entire DOM document and invoke its "getElementsByTagName(tagName)" method with tagName equal to "*". The method should return a NodeList that contains all the elements of the document. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-A6C9094 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=251 */ specify("hc_documentgetelementsbytagnametotallength", () => { let expectedNames = ["HTML", "HEAD", "META", "TITLE", "BODY", "P", "EM", "STRONG", "CODE", "SUP", "VAR", "ACRONYM", "P", "EM", "STRONG", "CODE", "SUP", "VAR", "ACRONYM", "P", "EM", "STRONG", "CODE", "SUP", "VAR", "ACRONYM", "P", "EM", "STRONG", "CODE", "SUP", "VAR", "ACRONYM", "P", "EM", "STRONG", "CODE", "SUP", "VAR", "ACRONYM"]; let actualNames = []; let doc = hc_staff.hc_staff(); let nameList = doc.getElementsByTagName("*"); for (let i = 0; i < nameList.length; i++) { actualNames.push(nameList.item(i).tagName); } assert.deepEqual(actualNames, expectedNames); }); /** * The "getElementsByTagName(tagName)" method returns a NodeList of all the Elements with a given tagName in a pre-order traversal of the tree. Retrieve the entire DOM document and invoke its "getElementsByTagName(tagName)" method with tagName equal to "strong". The method should return a NodeList that contains 5 elements. The FOURTH item in the list is retrieved and output. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-A6C9094 */ specify("hc_documentgetelementsbytagnamevalue", () => { let success; let doc; let nameList; let nameNode; let firstChild; let childValue; doc = hc_staff.hc_staff(); nameList = doc.getElementsByTagName("strong"); nameNode = nameList.item(3); firstChild = nameNode.firstChild; childValue = firstChild.nodeValue; assert.equal(childValue, "Jeny Oconnor", "documentGetElementsByTagNameValueAssert"); }); /** * Retrieve the entire DOM document and invoke its "getImplementation()" method. If contentType="text/html", DOMImplementation.hasFeature("HTML","1.0") should be true. Otherwise, DOMImplementation.hasFeature("XML", "1.0") should be true. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1B793EBA * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=245 */ specify("hc_documentgetimplementation", () => { let doc = hc_staff.hc_staff(); assert.ok(doc.implementation.hasFeature("HTML", "1.0"), "supports_HTML_1.0"); }); /** * Load a document and invoke its "getDocumentElement()" method. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-87CD092 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=251 */ specify("hc_documentgetrootnode", () => { let doc = hc_staff.hc_staff(); assert.equal(doc.documentElement.nodeName, "HTML"); }); /** * The "createAttribute(tagName)" method raises an INVALID_CHARACTER_ERR DOMException if the specified tagName contains an invalid character. Retrieve the entire DOM document and invoke its "createAttribute(tagName)" method with the tagName equal to the string "invalid^Name". Due to the invalid character the desired EXCEPTION should be raised. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INVALID_CHARACTER_ERR']) * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1084891198 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-1084891198')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INVALID_CHARACTER_ERR']) * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1084891198 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=249 */ specify("hc_documentinvalidcharacterexceptioncreateattribute", () => { let doc = hc_staff.hc_staff(); let success = false; try { doc.createAttribute("invalid'Name"); } catch (ex) { success = (typeof (ex.code) !== "undefined" && ex.code === 5); } assert.ok(success, "throw_INVALID_CHARACTER_ERR"); }); /** * Creating an attribute with an empty name should cause an INVALID_CHARACTER_ERR. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INVALID_CHARACTER_ERR']) * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1084891198 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-1084891198')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INVALID_CHARACTER_ERR']) * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1084891198 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=525 */ specify("hc_documentinvalidcharacterexceptioncreateattribute1", () => { let doc = hc_staff.hc_staff(); let success = false; try { doc.createAttribute(""); } catch (ex) { success = (typeof (ex.code) !== "undefined" && ex.code === 5); } assert.ok(success, "throw_INVALID_CHARACTER_ERR"); }); /** * The "createElement(tagName)" method raises an INVALID_CHARACTER_ERR DOMException if the specified tagName contains an invalid character. Retrieve the entire DOM document and invoke its "createElement(tagName)" method with the tagName equal to the string "invalid^Name". Due to the invalid character the desired EXCEPTION should be raised. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INVALID_CHARACTER_ERR']) * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-2141741547 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-2141741547')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INVALID_CHARACTER_ERR']) * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-2141741547 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=249 */ specify("hc_documentinvalidcharacterexceptioncreateelement", () => { let doc = hc_staff.hc_staff(); let success = false; try { doc.createElement("invalid^Name"); } catch (ex) { success = (typeof (ex.code) !== "undefined" && ex.code === 5); } assert.ok(success, "throw_INVALID_CHARACTER_ERR"); }); /** * Creating an element with an empty name should cause an INVALID_CHARACTER_ERR. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INVALID_CHARACTER_ERR']) * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-2141741547 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-2141741547')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INVALID_CHARACTER_ERR']) * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-2141741547 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=525 */ specify("hc_documentinvalidcharacterexceptioncreateelement1", () => { let doc = hc_staff.hc_staff(); let success = false; try { doc.createElement(""); } catch (ex) { success = (typeof (ex.code) !== "undefined" && ex.code === 5); } assert.ok(success, "throw_INVALID_CHARACTER_ERR"); }); /** * Load a document and invoke its "getImplementation()" method. This should create a DOMImplementation object whose "hasFeature(feature, version)" method is invoked with version equal to "". If the version is not specified, supporting any version feature will cause the method to return "true". * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-5CED94D7 * @see http://www.w3.org/2000/11/DOM-Level-2-errata#core-14 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=245 */ specify("hc_domimplementationfeaturenoversion", () => { let doc = hc_staff.hc_staff(); assert.ok(doc.implementation.hasFeature("HTML", ""), "hasFeatureBlank"); }); /** * Load a document and invoke its "getImplementation()" method. This should create a DOMImplementation object whose "hasFeature(feature, version)" method is invoked with version equal to null. If the version is not specified, supporting any version feature will cause the method to return "true". * @author Curt Arnold * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-5CED94D7 * @see http://www.w3.org/2000/11/DOM-Level-2-errata#core-14 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=245 */ specify("hc_domimplementationfeaturenull", () => { let doc = hc_staff.hc_staff(); assert.ok(doc.implementation.hasFeature("HTML", null), "supports_HTML_null"); }); /** * Retrieve the entire DOM document and invoke its "getImplementation()" method. This should create a DOMImplementation object whose "hasFeature(feature, version)" method is invoked with "feature" equal to "html" or "xml". The method should return a boolean "true". * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-5CED94D7 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=245 */ specify("hc_domimplementationfeaturexml", () => { let doc = hc_staff.hc_staff(); assert.ok(doc.implementation.hasFeature("html", "1.0"), "supports_html_1.0"); }); /** * The "setAttribute(name,value)" method adds a new attribute to the Element Retrieve the last child of the last employee, then add an attribute to it by invoking the "setAttribute(name,value)" method. It should create a "strong" attribute with an assigned value equal to "value". * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68F082 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=243 */ specify("hc_elementaddnewattribute", () => { let success; let doc; let elementList; let testEmployee; let attrValue; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("acronym"); testEmployee = elementList.item(4); testEmployee.setAttribute("lang", "EN-us"); attrValue = testEmployee.getAttribute("lang"); assert.equal(attrValue, "EN-us", "attrValue"); }); /** * Retrieve the first attribute from the last child of the first employee and invoke the "getSpecified()" method. This test is only intended to show that Elements can actually have attributes. This test uses the "getNamedItem(name)" method from the NamedNodeMap interface. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-84CF096 */ specify("hc_elementassociatedattribute", () => { let success; let doc; let elementList; let testEmployee; let attributes; let domesticAttr; let specified; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("acronym"); testEmployee = elementList.item(0); attributes = testEmployee.attributes; domesticAttr = attributes.getNamedItem("title"); specified = domesticAttr.specified; assert.ok(specified, "acronymTitleSpecified"); }); /** * The "setAttribute(name,value)" method adds a new attribute to the Element. If the "strong" is already present, then its value should be changed to the new one that is in the "value" parameter. Retrieve the last child of the fourth employee, then add an attribute to it by invoking the "setAttribute(name,value)" method. Since the name of the used attribute("class") is already present in this element, then its value should be changed to the new one of the "value" parameter. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68F082 */ specify("hc_elementchangeattributevalue", () => { let success; let doc; let elementList; let testEmployee; let attrValue; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("acronym"); testEmployee = elementList.item(3); testEmployee.setAttribute("class", "Neither"); attrValue = testEmployee.getAttribute("class"); assert.equal(attrValue, "Neither", "elementChangeAttributeValueAssert"); }); /** * The "setAttributeNode(newAttr)" method adds a new attribute to the Element. Retrieve first address element and add a new attribute node to it by invoking its "setAttributeNode(newAttr)" method. This test makes use of the "createAttribute(name)" method from the Document interface. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-887236154 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=243 */ specify("hc_elementcreatenewattribute", () => { let success; let doc; let elementList; let testAddress; let newAttribute; let oldAttr; let districtAttr; let attrVal; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("acronym"); testAddress = elementList.item(0); newAttribute = doc.createAttribute("lang"); oldAttr = testAddress.setAttributeNode(newAttribute); assert.equal(oldAttr, null, "old_attr_doesnt_exist"); districtAttr = testAddress.getAttributeNode("lang"); assert.notEqual(districtAttr, null, "new_district_accessible"); attrVal = testAddress.getAttribute("lang"); assert.equal(attrVal, "", "attr_value"); }); /** * Retrieve the attribute "title" from the last child of the first "p" element and check its node name. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-217A91B8 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=236 * @see http://lists.w3.org/Archives/Public/www-dom-ts/2003Jun/0011.html */ specify("hc_elementgetattributenode", () => { let doc = hc_staff.hc_staff(); let nodeName = doc.getElementsByTagName("acronym").item(0).getAttributeNode("title").name; assert.equal(nodeName, "title", "attribute nodeName"); }); /** * The "getAttributeNode(name)" method retrieves an attribute node by name. It should return null if the "strong" attribute does not exist. Retrieve the last child of the first employee and attempt to retrieve a non-existing attribute. The method should return "null". The non-existing attribute to be used is "invalidAttribute". * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-217A91B8 */ specify("hc_elementgetattributenodenull", () => { let success; let doc; let elementList; let testEmployee; let domesticAttr; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("acronym"); testEmployee = elementList.item(0); domesticAttr = testEmployee.getAttributeNode("invalidAttribute"); assert.equal(domesticAttr, null, "elementGetAttributeNodeNullAssert"); }); /** * The "getAttribute(name)" method returns an empty string if no value was assigned to an attribute and no default value was given in the DTD file. Retrieve the last child of the last employee, then invoke "getAttribute(name)" method, where "strong" is an attribute without a specified or DTD default value. The "getAttribute(name)" method should return the empty string. This method makes use of the "createAttribute(newAttr)" method from the Document interface. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-666EE0F9 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=243 */ specify("hc_elementgetelementempty", () => { let success; let doc; let newAttribute; let elementList; let testEmployee; let domesticAttr; let attrValue; doc = hc_staff.hc_staff(); newAttribute = doc.createAttribute("lang"); elementList = doc.getElementsByTagName("acronym"); testEmployee = elementList.item(3); domesticAttr = testEmployee.setAttributeNode(newAttribute); attrValue = testEmployee.getAttribute("lang"); assert.equal(attrValue, "", "elementGetElementEmptyAssert"); }); /** * The "getElementsByTagName(name)" method returns a list of all descendant Elements with the given tag name. Test for an empty list. Create a NodeList of all the descendant elements using the string "noMatch" as the tagName. The method should return a NodeList whose length is "0" since there are not any descendant elements that match the given tag name. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1938918D */ specify("hc_elementgetelementsbytagname", () => { let success; let doc; let elementList; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("p"); assert.equal(elementList.length, 5, "elementGetElementsByTagNameAssert"); }); /** * The "getElementsByTagName(name)" method returns a list of all descendant Elements in the order the children were encountered in a pre order traversal of the element tree. Create a NodeList of all the descendant elements using the string "p" as the tagName. The method should return a NodeList whose length is "5" in the order the children were encountered. Access the FOURTH element in the NodeList. The FOURTH element, the first or second should be an "em" node with the content "EMP0004". * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1938918D * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=246 */ specify("hc_elementgetelementsbytagnameaccessnodelist", () => { let doc = hc_staff.hc_staff(); let firstC = doc.getElementsByTagName("p").item(3).firstChild; let nodeType = firstC.nodeType; while (nodeType === 3) { firstC = firstC.nextSibling; nodeType = firstC.nodeType; } assert.equal(firstC.nodeName, "EM", "element childName"); assert.equal(firstC.firstChild.nodeValue, "EMP0004", "employeeID"); }); /** * The "getElementsByTagName(name)" method returns a list of all descendant Elements with the given tag name. Create a NodeList of all the descendant elements using the string "employee" as the tagName. The method should return a NodeList whose length is "5". * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1938918D */ specify("hc_elementgetelementsbytagnamenomatch", () => { let success; let doc; let elementList; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("noMatch"); assert.equal(elementList.length, 0, "elementGetElementsByTagNameNoMatchNoMatchAssert"); }); /** * The "getElementsByTagName(name)" method may use the special value "*" to match all tags in the element tree. Create a NodeList of all the descendant elements of the last employee by using the special value "*". The method should return all the descendant children(6) in the order the children were encountered. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1938918D */ specify("hc_elementgetelementsbytagnamespecialvalue", () => { let doc = hc_staff.hc_staff(); let lastempList = doc.getElementsByTagName("p").item(4).getElementsByTagName("*"); let actual = []; for (let i = 0; i < lastempList.length; i++) { actual.push(lastempList.item(i).nodeName); } assert.deepEqual(actual, ["EM", "STRONG", "CODE", "SUP", "VAR", "ACRONYM"], "element tagNames"); }); /** * Invoke the "getTagName()" method one the root node. The value returned should be "html" or "svg". * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-104682815 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=251 */ specify("hc_elementgettagname", () => { let doc = hc_staff.hc_staff(); assert.equal(doc.documentElement.tagName, "HTML"); }); /** * The "setAttributeNode(newAttr)" method raises an "INUSE_ATTRIBUTE_ERR DOMException if the "newAttr" is already an attribute of another element. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INUSE_ATTRIBUTE_ERR']) * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-887236154 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-887236154')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INUSE_ATTRIBUTE_ERR']) * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=244 */ specify("hc_elementinuseattributeerr", () => { let doc = hc_staff.hc_staff(); let testAddress = doc.getElementsByTagName("body").item(0); let newElement = doc.createElement("p"); testAddress.appendChild(newElement); let newAttribute = doc.createAttribute("title"); newElement.setAttributeNode(newAttribute); let success = false; try { testAddress.setAttributeNode(newAttribute); } catch (ex) { success = (typeof (ex.code) !== "undefined" && ex.code === 10); } assert.ok(success, "throw_INUSE_ATTRIBUTE_ERR"); }); /** * The "setAttribute(name,value)" method raises an "INVALID_CHARACTER_ERR DOMException if the specified name contains an invalid character. Retrieve the last child of the first employee and call its "setAttribute(name,value)" method with "strong" containing an invalid character. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INVALID_CHARACTER_ERR']) * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68F082 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-F68F082')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INVALID_CHARACTER_ERR']) * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=249 */ specify("hc_elementinvalidcharacterexception", () => { let doc = hc_staff.hc_staff(); let testAddress = doc.getElementsByTagName("acronym").item(0); let success = false; try { testAddress.setAttribute("invalid'Name", "value"); } catch (ex) { success = (typeof (ex.code) !== "undefined" && ex.code === 5); } assert.ok(success, "throw_INVALID_CHARACTER_ERR"); }); /** * Calling Element.setAttribute with an empty name will cause an INVALID_CHARACTER_ERR. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INVALID_CHARACTER_ERR']) * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68F082 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-F68F082')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INVALID_CHARACTER_ERR']) * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=525 */ specify("hc_elementinvalidcharacterexception1", () => { let doc = hc_staff.hc_staff(); let testAddress = doc.getElementsByTagName("acronym").item(0); let success = false; try { testAddress.setAttribute("", "value"); } catch (ex) { success = (typeof (ex.code) !== "undefined" && ex.code === 5); } assert.ok(success, "throw_INVALID_CHARACTER_ERR"); }); /** * Append a couple of text nodes to the first sup element, normalize the document element and check that the element has been normalized. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-162CF083 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=546 */ specify("hc_elementnormalize", () => { let success; let doc; let root; let elementList; let testName; let firstChild; let childValue; let textNode; let retNode; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("sup"); testName = elementList.item(0); textNode = doc.createTextNode(""); retNode = testName.appendChild(textNode); textNode = doc.createTextNode(",000"); retNode = testName.appendChild(textNode); root = doc.documentElement; root.normalize(); elementList = doc.getElementsByTagName("sup"); testName = elementList.item(0); firstChild = testName.firstChild; childValue = firstChild.nodeValue; assert.equal(childValue, "56,000,000", "elementNormalizeAssert"); }); /** * The "removeAttributeNode(oldAttr)" method raises a NOT_FOUND_ERR DOMException if the "oldAttr" attribute is not an attribute of the element. Retrieve the last employee and attempt to remove a non existing attribute node. This should cause the intended exception to be raised. This test makes use of the "createAttribute(name)" method from the Document interface. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INUSE_ATTRIBUTE_ERR']) * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-D589198 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-D589198')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INUSE_ATTRIBUTE_ERR']) * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=249 */ specify("hc_elementnotfounderr", () => { let doc = hc_staff.hc_staff(); let testAddress = doc.getElementsByTagName("acronym").item(4); let oldAttribute = doc.createAttribute("title"); let success = false; try { testAddress.removeAttributeNode(oldAttribute); } catch (ex) { success = (typeof (ex.code) !== "undefined" && ex.code === 8); } assert.ok(success, "throw_NOT_FOUND_ERR"); }); /** * The "removeAttribute(name)" removes an attribute by name. If the attribute has a default value, it is immediately replaced. However, there is no default values in the HTML compatible tests, so its value is "". * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-6D6AC0F9 * @see http://lists.w3.org/Archives/Public/www-dom-ts/2002Mar/0002.html */ specify("hc_elementremoveattribute", () => { let success; let doc; let elementList; let testEmployee; let attrValue; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("acronym"); testEmployee = elementList.item(3); testEmployee.removeAttribute("class"); attrValue = testEmployee.getAttribute("class"); // XXX SUPERSEDED BY DOM4 assert.strictEqual(attrValue, null, "attrValue"); // test.equal(attrValue, "", 'attrValue'); }); /** * The "removeAttributeNode(oldAttr)" method removes the specified attribute. Retrieve the last child of the third employee, add a new "lang" attribute to it and then try to remove it. To verify that the node was removed use the "getNamedItem(name)" method from the NamedNodeMap interface. It also uses the "getAttributes()" method from the Node interface. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-D589198 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=243 */ specify("hc_elementremoveattributeaftercreate", () => { let success; let doc; let elementList; let testEmployee; let newAttribute; let attributes; let districtAttr; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("acronym"); testEmployee = elementList.item(2); newAttribute = doc.createAttribute("lang"); districtAttr = testEmployee.setAttributeNode(newAttribute); districtAttr = testEmployee.removeAttributeNode(newAttribute); attributes = testEmployee.attributes; districtAttr = attributes.getNamedItem("lang"); assert.equal(districtAttr, null, "removed_item_null"); }); /** * The "removeAttributeNode(oldAttr)" method returns the node that was removed. Retrieve the last child of the third employee and remove its "class" Attr node. The method should return the old attribute node. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-D589198 */ specify("hc_elementremoveattributenode", () => { let success; let doc; let elementList; let testEmployee; let streetAttr; let removedAttr; let removedValue; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("acronym"); testEmployee = elementList.item(2); streetAttr = testEmployee.getAttributeNode("class"); removedAttr = testEmployee.removeAttributeNode(streetAttr); assert.notEqual(removedAttr, null, "removedAttrNotNull"); removedValue = removedAttr.value; assert.equal(removedValue, "No", "elementRemoveAttributeNodeAssert"); }); /** * This test calls setAttributeNode to replace an attribute with itself. Since the node is not an attribute of another Element, it would be inappropriate to throw an INUSE_ATTRIBUTE_ERR. This test was derived from elementinuserattributeerr which inadvertanly made this test. * @author Curt Arnold * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-887236154 */ specify("hc_elementreplaceattributewithself", () => { let doc = hc_staff.hc_staff(); let testEmployee = doc.getElementsByTagName("acronym").item(2); let streetAttr = testEmployee.getAttributeNode("class"); let replacedAttr = testEmployee.setAttributeNode(streetAttr); assert.equal(replacedAttr, streetAttr, "replacedAttr"); }); /** * The "setAttributeNode(newAttr)" method adds a new attribute to the Element. If the "newAttr" Attr node is already present in this element, it should replace the existing one. Retrieve the last child of the third employee and add a new attribute node by invoking the "setAttributeNode(new Attr)" method. The new attribute node to be added is "class", which is already present in this element. The method should replace the existing Attr node with the new one. This test uses the "createAttribute(name)" method from the Document interface. * @author Curt Arnold */ specify("hc_elementreplaceexistingattribute", () => { let success; let doc; let elementList; let testEmployee; let newAttribute; let strong; let setAttr; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("acronym"); testEmployee = elementList.item(2); newAttribute = doc.createAttribute("class"); setAttr = testEmployee.setAttributeNode(newAttribute); strong = testEmployee.getAttribute("class"); assert.equal(strong, "", "replacedValue"); }); /** * If the "setAttributeNode(newAttr)" method replaces an existing Attr node with the same name, then it should return the previously existing Attr node. Retrieve the last child of the third employee and add a new attribute node. The new attribute node is "class", which is already present in this Element. The method should return the existing Attr node(old "class" Attr). This test uses the "createAttribute(name)" method from the Document interface. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-887236154 */ specify("hc_elementreplaceexistingattributegevalue", () => { let success; let doc; let elementList; let testEmployee; let newAttribute; let streetAttr; let value; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("acronym"); testEmployee = elementList.item(2); newAttribute = doc.createAttribute("class"); streetAttr = testEmployee.setAttributeNode(newAttribute); assert.notEqual(streetAttr, null, "previousAttrNotNull"); value = streetAttr.value; assert.equal(value, "No", "previousAttrValue"); }); /** * Create a list of all the attributes of the last child of the first "p" element by using the "getAttributes()" method. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-84CF096 * @see http://lists.w3.org/Archives/Public/www-dom-ts/2002Mar/0002.html * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=184 */ specify("hc_elementretrieveallattributes", () => { let doc = hc_staff.hc_staff(); let attributes = doc.getElementsByTagName("acronym").item(0).attributes; let actual = []; for (let i = 0; i < attributes.length; i++) { actual.push(attributes.item(i).name); } assert.deepEqual(actual, ["title"]); }); /** * The "getAttribute(name)" method returns an attribute value by name. Retrieve the second address element, then invoke the 'getAttribute("class")' method. This should return the value of the attribute("No"). * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-666EE0F9 */ specify("hc_elementretrieveattrvalue", () => { let success; let doc; let elementList; let testAddress; let attrValue; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("acronym"); testAddress = elementList.item(2); attrValue = testAddress.getAttribute("class"); assert.equal(attrValue, "No", "attrValue"); }); /** * The "getElementsByTagName()" method returns a NodeList of all descendant elements with a given tagName. Invoke the "getElementsByTagName()" method and create a NodeList of "code" elements. Retrieve the second "code" element in the list and return the NodeName. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D095 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-104682815 */ specify("hc_elementretrievetagname", () => { let doc = hc_staff.hc_staff(); let testEmployee = doc.getElementsByTagName("code").item(1); assert.equal(testEmployee.nodeName, "CODE", "element nodeName"); assert.equal(testEmployee.tagName, "CODE", "element tagName"); }); /** * The "setAttributeNode(newAttr)" method returns the null value if no previously existing Attr node with the same name was replaced. Retrieve the last child of the third employee and add a new attribute to it. The new attribute node added is "lang", which is not part of this Element. The method should return the null value. This test uses the "createAttribute(name)" method from the Document interface. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-887236154 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=243 */ specify("hc_elementsetattributenodenull", () => { let success; let doc; let elementList; let testEmployee; let newAttribute; let districtAttr; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("acronym"); testEmployee = elementList.item(2); newAttribute = doc.createAttribute("lang"); districtAttr = testEmployee.setAttributeNode(newAttribute); assert.equal(districtAttr, null, "elementSetAttributeNodeNullAssert"); }); /** * An attempt to add remove an entity should result in a NO_MODIFICATION_ERR. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1788794630 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-D58B193 */ specify("hc_entitiesremovenameditem1", () => { // NOTE: no tests get run here... }); /** * An attempt to add an element to the named node map returned by entities should result in a NO_MODIFICATION_ERR or HIERARCHY_REQUEST_ERR. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1788794630 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1025163788 */ specify("hc_entitiessetnameditem1", () => { // NOTE: no tests get run here }); /** * Create a NamedNodeMap object from the attributes of the last child of the third "p" element and traverse the list from index 0 thru length -1. All indices should be valid. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-84CF096 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-349467F9 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-6D0FB19E * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=250 */ specify("hc_namednodemapchildnoderange", () => { let doc = hc_staff.hc_staff(); let attributes = doc.getElementsByTagName("acronym").item(2).attributes; assert.equal(attributes.length, 2, "htmlLength"); assert.notEqual(attributes.item(0), null, "attr0"); assert.notEqual(attributes.item(1), null, "attr1"); assert.equal(attributes.item(3), null, "attr3"); }); /** * Retrieve the second "p" element and create a NamedNodeMap listing of the attributes of the last child. Once the list is created an invocation of the "getNamedItem(name)" method is done with name="title". This should result in the title Attr node being returned. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1074577549 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-349467F9 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=236 * @see http://lists.w3.org/Archives/Public/www-dom-ts/2003Jun/0011.html */ specify("hc_namednodemapgetnameditem", () => { let doc = hc_staff.hc_staff(); let domesticAttr = doc.getElementsByTagName("acronym").item(1).attributes.getNamedItem("title"); assert.equal(domesticAttr.name, "title", "attribute nodeName"); }); /** * The "setNamedItem(arg)" method raises a INUSE_ATTRIBUTE_ERR DOMException if "arg" is an Attr that is already in an attribute of another Element. Create a NamedNodeMap object from the attributes of the last child of the third employee and attempt to add an attribute that is already being used by the first employee. This should raise the desired exception. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INUSE_ATTRIBUTE_ERR']) * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1025163788 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-1025163788')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INUSE_ATTRIBUTE_ERR']) * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=249 */ specify("hc_namednodemapinuseattributeerr", () => { let doc = hc_staff.hc_staff(); let firstNode = doc.getElementsByTagName("acronym").item(0); let domesticAttr = doc.createAttribute("title"); domesticAttr.value = "Yα"; firstNode.setAttributeNode(domesticAttr); let attributes = doc.getElementsByTagName("acronym").item(2).attributes; let success = false; try { attributes.setNamedItem(domesticAttr); } catch (ex) { success = (typeof (ex.code) !== "undefined" && ex.code === 10); } assert.ok(success, "throw_INUSE_ATTRIBUTE_ERR"); }); /** * The "removeNamedItem(name)" method raises a NOT_FOUND_ERR DOMException if there is not a node named "strong" in the map. Create a NamedNodeMap object from the attributes of the last child of the third employee and attempt to remove the "lang" attribute. There is not a node named "lang" in the list and therefore the desired exception should be raised. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INUSE_ATTRIBUTE_ERR']) * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-D58B193 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-D58B193')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INUSE_ATTRIBUTE_ERR']) * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=243 */ specify("hc_namednodemapnotfounderr", () => { let doc = hc_staff.hc_staff(); let attributes = doc.getElementsByTagName("acronym").item(2).attributes; let success = false; try { attributes.removeNamedItem("lang"); } catch (ex) { success = (typeof (ex.code) !== "undefined" && ex.code === 8); } assert.ok(success, "throw_NOT_FOUND_ERR"); }); /** * Retrieve the second "p" element and evaluate Node.attributes.length. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-84CF096 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-6D0FB19E * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=250 */ specify("hc_namednodemapnumberofnodes", () => { let doc = hc_staff.hc_staff(); let attributes = doc.getElementsByTagName("acronym").item(2).attributes; assert.equal(attributes.length, 2, "htmlLength"); }); /** * The "removeNamedItem(name)" method removes a node specified by name. Retrieve the third employee and create a NamedNodeMap object of the attributes of the last child. Once the list is created invoke the "removeNamedItem(name)" method with name="class". This should result in the removal of the specified attribute. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-D58B193 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-349467F9 * @see http://lists.w3.org/Archives/Public/www-dom-ts/2002Mar/0002.html */ specify("hc_namednodemapremovenameditem", () => { let success; let doc; let elementList; let newAttribute; let testAddress; let attributes; let streetAttr; let specified; let removedNode; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("acronym"); testAddress = elementList.item(2); attributes = testAddress.attributes; removedNode = attributes.removeNamedItem("class"); streetAttr = attributes.getNamedItem("class"); assert.equal(streetAttr, null, "isnull"); }); /** * Retrieve the second p element and create a NamedNodeMap listing of the attributes of the last child. Once the list is created an invocation of the "getNamedItem(name)" method is done with name="class". This should result in the method returning an Attr node. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1074577549 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-84CF096 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-637646024 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1112119403 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=236 */ specify("hc_namednodemapreturnattrnode", () => { let doc = hc_staff.hc_staff(); let streetAttr = doc.getElementsByTagName("acronym").item(1).attributes.getNamedItem("class"); assert.equal(streetAttr.name, "class", "attribute name"); }); /** * The "item(index)" method returns the indexth item in the map(test for first item). Retrieve the second "acronym" get the NamedNodeMap of the attributes. Since the DOM does not specify an order of these nodes the contents of the FIRST node can contain either "title", "class" or "dir". * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-349467F9 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=236 * @see http://lists.w3.org/Archives/Public/www-dom-ts/2003Jun/0011.html * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=184 */ specify("hc_namednodemapreturnfirstitem", () => { let doc = hc_staff.hc_staff(); let attributes = doc.getElementsByTagName("acronym").item(1).attributes; let actual = []; for (let i = 0; i < attributes.length; i++) { actual.push(attributes.item(i).name); } // assertEqualsCollection("attrName_html",toLowerArray(htmlExpected),toLowerArray(actual)); assert.deepEqual(actual, ["title", "class"]); }); /** * The "item(index)" method returns the indexth item in the map(test for last item). Retrieve the second "acronym" and get the attribute name. Since the DOM does not specify an order of these nodes the contents of the LAST node can contain either "title" or "class". The test should return "true" if the LAST node is either of these values. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-349467F9 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=236 * @see http://lists.w3.org/Archives/Public/www-dom-ts/2003Jun/0011.html * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=184 */ specify("hc_namednodemapreturnlastitem", () => { let doc = hc_staff.hc_staff(); let attributes = doc.getElementsByTagName("acronym").item(1).attributes; let actual = []; for (let i = 0; i < attributes.length; i++) { actual.push(attributes.item(i).name); } assert.deepEqual(actual, ["title", "class"]); }); /** * The "getNamedItem(name)" method returns null of the specified name did not identify any node in the map. Retrieve the second employee and create a NamedNodeMap listing of the attributes of the last child. Once the list is created an invocation of the "getNamedItem(name)" method is done with name="lang". This name does not match any names in the list therefore the method should return null. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1074577549 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=243 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=249 */ specify("hc_namednodemapreturnnull", () => { let success; let doc; let elementList; let testEmployee; let attributes; let districtNode; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("acronym"); testEmployee = elementList.item(1); attributes = testEmployee.attributes; districtNode = attributes.getNamedItem("lang"); assert.equal(districtNode, null, "langAttrNull"); }); /** * Retrieve the second "p" element and create a NamedNodeMap object from the attributes of the last child by invoking the "getAttributes()" method. Once the list is created an invocation of the "setNamedItem(arg)" method is done with arg=newAttr, where newAttr is a new Attr Node previously created. The "setNamedItem(arg)" method should add then new node to the NamedNodeItem object by using its "nodeName" attribute("lang'). This node is then retrieved using the "getNamedItem(name)" method. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1025163788 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-349467F9 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=236 * @see http://lists.w3.org/Archives/Public/www-dom-ts/2003Jun/0011.html * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=243 */ specify("hc_namednodemapsetnameditem", () => { let doc = hc_staff.hc_staff(); let testAddress = doc.getElementsByTagName("acronym").item(1); let newAttribute = doc.createAttribute("lang"); let attributes = testAddress.attributes; attributes.setNamedItem(newAttribute); assert.equal(attributes.getNamedItem("lang").name, "lang", "attribute nodeName"); }); /** * If the "setNamedItem(arg)" method replaces an already existing node with the same name then the already existing node is returned. Retrieve the third employee and create a NamedNodeMap object from the attributes of the last child by invoking the "getAttributes()" method. Once the list is created an invocation of the "setNamedItem(arg)" method is done with arg=newAttr, where newAttr is a new Attr Node previously created and whose node name already exists in the map. The "setNamedItem(arg)" method should replace the already existing node with the new one and return the existing node. This test uses the "createAttribute(name)" method from the document interface. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1025163788 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-349467F9 */ specify("hc_namednodemapsetnameditemreturnvalue", () => { let success; let doc; let elementList; let newAttribute; let testAddress; let attributes; let newNode; let attrValue; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("acronym"); testAddress = elementList.item(2); newAttribute = doc.createAttribute("class"); attributes = testAddress.attributes; newNode = attributes.setNamedItem(newAttribute); assert.notEqual(newNode, null, "previousAttrNotNull"); attrValue = newNode.nodeValue; assert.equal(attrValue, "No", "previousAttrValue"); }); /** * If the node to be added by the "setNamedItem(arg)" method already exists in the NamedNodeMap, it is replaced by the new one. Retrieve the second employee and create a NamedNodeMap object from the attributes of the last child by invoking the "getAttributes()" method. Once the list is created an invocation of the "setNamedItem(arg)" method is done with arg=newAttr, where newAttr is a new Attr Node previously created and whose node name already exists in the map. The "setNamedItem(arg)" method should replace the already existing node with the new one. This node is then retrieved using the "getNamedItem(name)" method. This test uses the "createAttribute(name)" method from the document interface * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1025163788 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-349467F9 */ specify("hc_namednodemapsetnameditemthatexists", () => { let success; let doc; let elementList; let newAttribute; let testAddress; let attributes; let districtNode; let attrValue; let setNode; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("acronym"); testAddress = elementList.item(1); newAttribute = doc.createAttribute("class"); attributes = testAddress.attributes; setNode = attributes.setNamedItem(newAttribute); districtNode = attributes.getNamedItem("class"); attrValue = districtNode.nodeValue; assert.equal(attrValue, "", "namednodemapSetNamedItemThatExistsAssert"); }); /** * If the "setNamedItem(arg)" method does not replace an existing node with the same name then it returns null. Retrieve the third employee and create a NamedNodeMap object from the attributes of the last child. Once the list is created the "setNamedItem(arg)" method is invoked with arg=newAttr, where newAttr is a newly created Attr Node and whose node name already exists in the map. The "setNamedItem(arg)" method should add the new node and return null. This test uses the "createAttribute(name)" method from the document interface. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1025163788 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-349467F9 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=243 */ specify("hc_namednodemapsetnameditemwithnewvalue", () => { let success; let doc; let elementList; let newAttribute; let testAddress; let attributes; let newNode; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("acronym"); testAddress = elementList.item(2); newAttribute = doc.createAttribute("lang"); attributes = testAddress.attributes; newNode = attributes.setNamedItem(newAttribute); assert.equal(newNode, null, "prevValueNull"); }); /** * Retrieve the second "p" and append a "br" Element node to the list of children. The last node in the list is then retrieved and its NodeName examined. The "getNodeName()" method should return "br". * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-184E7107 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=247 */ specify("hc_nodeappendchild", () => { let doc = hc_staff.hc_staff(); let employeeNode = doc.getElementsByTagName("p").item(1); let createdNode = doc.createElement("br"); employeeNode.appendChild(createdNode); let lchild = employeeNode.lastChild; assert.equal(lchild.nodeName, "BR", "element nodeName"); }); /** * If the "newChild" is already in the tree, it is first removed before the new one is appended. Retrieve the "em" second employee and append the first child to the end of the list. After the "appendChild(newChild)" method is invoked the first child should be the one that was second and the last child should be the one that was first. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-184E7107 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=246 */ specify("hc_nodeappendchildchildexists", () => { let expected = ["STRONG", "CODE", "SUP", "VAR", "ACRONYM", "EM"]; let doc = hc_staff.hc_staff(); let childNode = doc.getElementsByTagName("p").item(1); let childList = childNode.getElementsByTagName("*"); childNode.appendChild(childList.item(0)); let actual = []; for (let i = 0; i < childList.length; i++) { actual.push(childList.item(i).nodeName); } assert.deepEqual(actual, expected, "element liveByTagName"); childList = childNode.childNodes; let refreshedActual = []; for (let i = 0; i < childList.length; i++) { if (childList.item(i).nodeType === 1) { refreshedActual.push(childList.item(i).nodeName); } } assert.deepEqual(refreshedActual, expected, "element refreshedChildNodes"); }); /** * If the "newChild" is a DocumentFragment object then all its content is added to the child list of this node. Create and populate a new DocumentFragment object and append it to the second employee. After the "appendChild(newChild)" method is invoked retrieve the new nodes at the end of the list, they should be the two Element nodes from the DocumentFragment. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-184E7107 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=246 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=247 */ specify("hc_nodeappendchilddocfragment", () => { let success; let doc; let elementList; let employeeNode; let childList; let newdocFragment; let newChild1; let newChild2; let child; let childName; let result = new Array(); let appendedChild; let nodeType; let expected = ["EM", "STRONG", "CODE", "SUP", "VAR", "ACRONYM", "BR", "B"]; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("p"); employeeNode = elementList.item(1); childList = employeeNode.childNodes; newdocFragment = doc.createDocumentFragment(); newChild1 = doc.createElement("br"); newChild2 = doc.createElement("b"); appendedChild = newdocFragment.appendChild(newChild1); appendedChild = newdocFragment.appendChild(newChild2); appendedChild = employeeNode.appendChild(newdocFragment); for (let indexN100A2 = 0; indexN100A2 < childList.length; indexN100A2++) { child = childList.item(indexN100A2); nodeType = child.nodeType; if ( (nodeType === 1) ) { childName = child.nodeName; result[result.length] = childName; } } assert.deepEqual(result, expected, "element nodeNames"); }); /** * The "appendChild(newChild)" method returns the node added. Append a newly created node to the child list of the second employee and check the NodeName returned. The "getNodeName()" method should return "br". * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D095 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-184E7107 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=247 */ specify("hc_nodeappendchildgetnodename", () => { let doc = hc_staff.hc_staff(); let employeeNode = doc.getElementsByTagName("p").item(1); let newChild = doc.createElement("br"); let appendNode = employeeNode.appendChild(newChild); assert.equal(appendNode.nodeName, "BR", "element nodeName"); }); /** * The "appendChild(newChild)" method raises a HIERARCHY_REQUEST_ERR DOMException if the node to append is one of this node's ancestors. Retrieve the second employee and attempt to append an ancestor node(root node) to it. An attempt to make such an addition should raise the desired exception. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='HIERARCHY_REQUEST_ERR']) * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-184E7107 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-184E7107')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='HIERARCHY_REQUEST_ERR']) * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-184E7107 */ specify("hc_nodeappendchildnodeancestor", () => { let doc = hc_staff.hc_staff(); let newChild = doc.documentElement; let employeeNode = doc.getElementsByTagName("p").item(1); let success = false; try { employeeNode.appendChild(newChild); } catch (ex) { success = (typeof (ex.code) !== "undefined" && ex.code === 3); } assert.ok(success, "throw_HIERARCHY_REQUEST_ERR"); }); /** * The "getAttributes()" method invoked on an Attribute Node returns null. Retrieve the first attribute from the last child of the first employee and invoke the "getAttributes()" method on the Attribute Node. It should return null. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-84CF096 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-637646024 */ specify("hc_nodeattributenodeattribute", () => { let success; let doc; let elementList; let testAddr; let addrAttr; let attrNode; let attrList; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("acronym"); testAddr = elementList.item(0); addrAttr = testAddr.attributes; attrNode = addrAttr.item(0); attrList = attrNode.attributes; assert.equal(attrList, null, "nodeAttributeNodeAttributeAssert1"); }); /** * Retrieve the Attribute named "title" from the last child of the first p element and check the string returned by the "getNodeName()" method. It should be equal to "title". * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D095 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=236 */ specify("hc_nodeattributenodename", () => { let doc = hc_staff.hc_staff(); let addrAttr = doc.getElementsByTagName("acronym").item(0).getAttributeNode("title"); assert.equal(addrAttr.name, "title", "attribute nodeName"); }); /** * The string returned by the "getNodeValue()" method for an Attribute Node is the value of the Attribute. Retrieve the Attribute named "title" from the last child of the first "p" and check the string returned by the "getNodeValue()" method. It should be equal to "Yes". * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D080 */ specify("hc_nodeattributenodevalue", () => { let success; let doc; let elementList; let testAddr; let addrAttr; let attrValue; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("acronym"); testAddr = elementList.item(0); addrAttr = testAddr.getAttributeNode("title"); attrValue = addrAttr.nodeValue; assert.equal(attrValue, "Yes", "nodeValue"); }); /** * The "getChildNodes()" method returns a NodeList that contains all children of this node. Retrieve the second employee and check the NodeList returned by the "getChildNodes()" method. The length of the list should be 13. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1451460987 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=246 */ specify("hc_nodechildnodes", () => { let success; let doc; let elementList; let employeeNode; let childNode; let childNodes; let nodeType; let childName; let actual = new Array(); let expected = ["EM", "STRONG", "CODE", "SUP", "VAR", "ACRONYM"]; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("p"); employeeNode = elementList.item(1); childNodes = employeeNode.childNodes; for (let indexN1006C = 0; indexN1006C < childNodes.length; indexN1006C++) { childNode = childNodes.item(indexN1006C); nodeType = childNode.nodeType; childName = childNode.nodeName; if ( (nodeType === 1) ) { actual[actual.length] = childName; } else { assert.equal(nodeType, 3, "textNodeType"); } } assert.deepEqual(actual, expected, "element elementNames"); }); /** * The NodeList returned by the "getChildNodes()" method is live. Changes on the node's children are immediately reflected on the nodes returned in the NodeList. Create a NodeList of the children of the second employee and then add a newly created element that was created by the "createElement()" method(Document Interface) to the second employee by using the "appendChild()" method. The length of the NodeList should reflect this new addition to the child list. It should return the value 14. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1451460987 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-184E7107 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=246 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=247 */ specify("hc_nodechildnodesappendchild", () => { let success; let doc; let elementList; let employeeNode; let childList; let createdNode; let childNode; let childName; let childType; let textNode; let actual = new Array(); let expected = ["EM", "STRONG", "CODE", "SUP", "VAR", "ACRONYM", "BR"]; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("p"); employeeNode = elementList.item(1); childList = employeeNode.childNodes; createdNode = doc.createElement("br"); employeeNode = employeeNode.appendChild(createdNode); for (let indexN10087 = 0; indexN10087 < childList.length; indexN10087++) { childNode = childList.item(indexN10087); childName = childNode.nodeName; childType = childNode.nodeType; if ( (childType === 1) ) { actual[actual.length] = childName; } else { assert.equal(childType, 3, "textNodeType"); } } assert.deepEqual(actual, expected, "element childElements"); }); /** * The "getChildNodes()" method returns a NodeList that contains all children of this node. If there are not any children, this is a NodeList that does not contain any nodes. Retrieve the character data of the second "em" node and invoke the "getChildNodes()" method. The NodeList returned should not have any nodes. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1451460987 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=246 */ specify("hc_nodechildnodesempty", () => { let success; let doc; let elementList; let childList; let employeeNode; let textNode; let length; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("em"); employeeNode = elementList.item(1); textNode = employeeNode.firstChild; childList = textNode.childNodes; length = childList.length; assert.equal(length, 0, "length_zero"); }); /** * Retrieve the second acronym element and invoke the cloneNode method. The duplicate node returned by the method should copy the attributes associated with this node. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-84CF096 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=236 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=184 */ specify("hc_nodecloneattributescopied", () => { let doc = hc_staff.hc_staff(); let attributes = doc.getElementsByTagName("acronym").item(1).cloneNode(false).attributes; let actual = []; for (let i = 0; i < attributes.length; i++) { actual.push(attributes.item(i).name); } assert.deepEqual(actual, ["title", "class"]); }); /** * The "cloneNode(deep)" method does not copy text unless it is deep cloned.(Test for deep=false) Retrieve the fourth child of the second employee and the "cloneNode(deep)" method with deep=false. The duplicate node returned by the method should not copy any text data contained in this node. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-3A0ED0A4 */ specify("hc_nodeclonefalsenocopytext", () => { let success; let doc; let elementList; let employeeNode; let childList; let childNode; let clonedNode; let lastChildNode; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("p"); employeeNode = elementList.item(1); childList = employeeNode.childNodes; childNode = childList.item(3); clonedNode = childNode.cloneNode(false); lastChildNode = clonedNode.lastChild; assert.equal(lastChildNode, null, "nodeCloneFalseNoCopyTextAssert1"); }); /** * The duplicate node returned by the "cloneNode(deep)" method does not have a ParentNode. Retrieve the second employee and invoke the "cloneNode(deep)" method with deep=false. The duplicate node returned should return null when the "getParentNode()" is invoked. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-3A0ED0A4 */ specify("hc_nodeclonegetparentnull", () => { let success; let doc; let elementList; let employeeNode; let clonedNode; let parentNode; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("p"); employeeNode = elementList.item(1); clonedNode = employeeNode.cloneNode(false); parentNode = clonedNode.parentNode; assert.equal(parentNode, null, "nodeCloneGetParentNullAssert1"); }); /** * The "cloneNode(deep)" method returns a copy of the node only if deep=false. Retrieve the second employee and invoke the "cloneNode(deep)" method with deep=false. The method should only clone this node. The NodeName and length of the NodeList are checked. The "getNodeName()" method should return "employee" and the "getLength()" method should return 0. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-3A0ED0A4 */ specify("hc_nodeclonenodefalse", () => { let doc = hc_staff.hc_staff(); let clonedNode = doc.getElementsByTagName("p").item(1).cloneNode(false); assert.equal(clonedNode.nodeName, "P", "element strong"); assert.equal(clonedNode.childNodes.length, 0, "length"); }); /** * The "cloneNode(deep)" method returns a copy of the node and the subtree under it if deep=true. Retrieve the second employee and invoke the "cloneNode(deep)" method with deep=true. The method should clone this node and the subtree under it. The NodeName of each child in the returned node is checked to insure the entire subtree under the second employee was cloned. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-3A0ED0A4 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=246 */ specify("hc_nodeclonenodetrue", () => { let success; let doc; let elementList; let employeeNode; let clonedNode; let clonedList; let clonedChild; let clonedChildName; let origList; let origChild; let origChildName; let result = new Array(); let expected = new Array(); doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("p"); employeeNode = elementList.item(1); origList = employeeNode.childNodes; for (let indexN10065 = 0; indexN10065 < origList.length; indexN10065++) { origChild = origList.item(indexN10065); origChildName = origChild.nodeName; expected[expected.length] = origChildName; } clonedNode = employeeNode.cloneNode(true); clonedList = clonedNode.childNodes; for (let indexN1007B = 0; indexN1007B < clonedList.length; indexN1007B++) { clonedChild = clonedList.item(indexN1007B); clonedChildName = clonedChild.nodeName; result[result.length] = clonedChildName; } assert.deepEqual(result, expected, "clone"); }); /** * The "cloneNode(deep)" method does not copy text unless it is deep cloned.(Test for deep=true) Retrieve the eighth child of the second employee and the "cloneNode(deep)" method with deep=true. The duplicate node returned by the method should copy any text data contained in this node. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-3A0ED0A4 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=246 */ specify("hc_nodeclonetruecopytext", () => { let success; let doc; let elementList; let childNode; let clonedNode; let lastChildNode; let childValue; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("sup"); childNode = elementList.item(1); clonedNode = childNode.cloneNode(true); lastChildNode = clonedNode.lastChild; childValue = lastChildNode.nodeValue; assert.equal(childValue, "35,000", "cloneContainsText"); }); /** * The "getAttributes()" method invoked on a Comment Node returns null. Find any comment that is an immediate child of the root and assert that Node.attributes is null. Then create a new comment node (in case they had been omitted) and make the assertion. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-84CF096 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1728279322 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=248 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=263 */ specify("hc_nodecommentnodeattributes", () => { let success; let doc; let commentNode; let nodeList; let attrList; let nodeType; doc = hc_staff.hc_staff(); nodeList = doc.childNodes; for (let indexN10043 = 0; indexN10043 < nodeList.length; indexN10043++) { commentNode = nodeList.item(indexN10043); nodeType = commentNode.nodeType; if ( (nodeType === 8) ) { attrList = commentNode.attributes; assert.equal(attrList, null, "existingCommentAttributesNull"); } } commentNode = doc.createComment("This is a comment"); attrList = commentNode.attributes; assert.equal(attrList, null, "createdCommentAttributesNull"); }); /** * The string returned by the "getNodeName()" method for a Comment Node is "#comment". Retrieve the Comment node in the XML file and check the string returned by the "getNodeName()" method. It should be equal to "#comment". * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D095 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1728279322 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=248 */ specify("hc_nodecommentnodename", () => { let success; let doc; let elementList; let commentNode; let nodeType; let commentName; let commentNodeName; doc = hc_staff.hc_staff(); elementList = doc.childNodes; for (let indexN10044 = 0; indexN10044 < elementList.length; indexN10044++) { commentNode = elementList.item(indexN10044); nodeType = commentNode.nodeType; if ( (nodeType === 8) ) { commentNodeName = commentNode.nodeName; assert.equal(commentNodeName, "#comment", "existingNodeName"); } } commentNode = doc.createComment("This is a comment"); commentNodeName = commentNode.nodeName; assert.equal(commentNodeName, "#comment", "createdNodeName"); }); /** * The "getNodeType()" method for a Comment Node returns the constant value 8. Retrieve the nodes from the document and check for a comment node and invoke the "getNodeType()" method. This should return 8. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-111237558 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1728279322 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=248 */ specify("hc_nodecommentnodetype", () => { let success; let doc; let testList; let commentNode; let commentNodeName; let nodeType; doc = hc_staff.hc_staff(); testList = doc.childNodes; for (let indexN10040 = 0; indexN10040 < testList.length; indexN10040++) { commentNode = testList.item(indexN10040); commentNodeName = commentNode.nodeName; if ( (commentNodeName === "#comment") ) { nodeType = commentNode.nodeType; assert.equal(nodeType, 8, "existingCommentNodeType"); } } commentNode = doc.createComment("This is a comment"); nodeType = commentNode.nodeType; assert.equal(nodeType, 8, "createdCommentNodeType"); }); /** * The string returned by the "getNodeValue()" method for a Comment Node is the content of the comment. Retrieve the comment in the XML file and check the string returned by the "getNodeValue()" method. It should be equal to "This is comment number 1". * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D080 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1728279322 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=248 */ specify("hc_nodecommentnodevalue", () => { let success; let doc; let elementList; let commentNode; let commentName; let commentValue; doc = hc_staff.hc_staff(); elementList = doc.childNodes; for (let indexN10040 = 0; indexN10040 < elementList.length; indexN10040++) { commentNode = elementList.item(indexN10040); commentName = commentNode.nodeName; if ( (commentName === "#comment") ) { commentValue = commentNode.nodeValue; assert.equal(commentValue, " This is comment number 1.", "value"); } } commentNode = doc.createComment(" This is a comment"); commentValue = commentNode.nodeValue; assert.equal(commentValue, " This is a comment", "createdCommentNodeValue"); }); /** * The string returned by the "getNodeName()" method for a DocumentFragment Node is "#document-frament". Retrieve the DOM document and invoke the "createDocumentFragment()" method and check the string returned by the "getNodeName()" method. It should be equal to "#document-fragment". * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D095 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-B63ED1A3 */ specify("hc_nodedocumentfragmentnodename", () => { let doc = hc_staff.hc_staff(); let docFragment = doc.createDocumentFragment(); assert.equal(docFragment.nodeName, "#document-fragment", "nodeDocumentFragmentNodeNameAssert1"); }); /** * The "getNodeType()" method for a DocumentFragment Node returns the constant value 11. Invoke the "createDocumentFragment()" method and examine the NodeType of the document fragment returned by the "getNodeType()" method. The method should return 11. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-111237558 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-B63ED1A3 */ specify("hc_nodedocumentfragmentnodetype", () => { let success; let doc; let documentFragmentNode; let nodeType; doc = hc_staff.hc_staff(); documentFragmentNode = doc.createDocumentFragment(); nodeType = documentFragmentNode.nodeType; assert.equal(nodeType, 11, "nodeDocumentFragmentNodeTypeAssert1"); }); /** * The string returned by the "getNodeValue()" method for a DocumentFragment Node is null. Retrieve the DOM document and invoke the "createDocumentFragment()" method and check the string returned by the "getNodeValue()" method. It should be equal to null. * @author Curt Arnold * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-B63ED1A3 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D080 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-84CF096 */ specify("hc_nodedocumentfragmentnodevalue", () => { let success; let doc; let docFragment; let attrList; let value; doc = hc_staff.hc_staff(); docFragment = doc.createDocumentFragment(); attrList = docFragment.attributes; assert.equal(attrList, null, "attributesNull"); value = docFragment.nodeValue; assert.equal(value, null, "initiallyNull"); }); /** * The "getAttributes()" method invoked on a Document Node returns null. Retrieve the DOM Document and invoke the "getAttributes()" method on the Document Node. It should return null. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-84CF096 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#i-Document */ specify("hc_nodedocumentnodeattribute", () => { let success; let doc; let attrList; doc = hc_staff.hc_staff(); attrList = doc.attributes; assert.equal(attrList, null, "doc_attributes_is_null"); }); /** * The string returned by the "getNodeName()" method for a Document Node is "#document". Retrieve the DOM document and check the string returned by the "getNodeName()" method. It should be equal to "#document". * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#i-Document * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D095 */ specify("hc_nodedocumentnodename", () => { let success; let doc; let documentName; doc = hc_staff.hc_staff(); documentName = doc.nodeName; assert.equal(documentName, "#document", "documentNodeName"); }); /** * The "getNodeType()" method for a Document Node returns the constant value 9. Retrieve the document and invoke the "getNodeType()" method. The method should return 9. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#i-Document * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-111237558 */ specify("hc_nodedocumentnodetype", () => { let success; let doc; let nodeType; doc = hc_staff.hc_staff(); nodeType = doc.nodeType; assert.equal(nodeType, 9, "nodeDocumentNodeTypeAssert1"); }); /** * The string returned by the "getNodeValue()" method for a Document Node is null. Retrieve the DOM Document and check the string returned by the "getNodeValue()" method. It should be equal to null. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#i-Document * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D080 */ specify("hc_nodedocumentnodevalue", () => { let success; let doc; let documentValue; doc = hc_staff.hc_staff(); documentValue = doc.nodeValue; assert.equal(documentValue, null, "documentNodeValue"); }); /** * Retrieve the third "acronym" element and evaluate Node.attributes. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-84CF096 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=236 * @see http://lists.w3.org/Archives/Public/www-dom-ts/2003Jun/0011.html * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=184 */ specify("hc_nodeelementnodeattributes", () => { let doc = hc_staff.hc_staff(); let attributes = doc.getElementsByTagName("acronym").item(2).attributes; let actual = []; for (let i = 0; i < attributes.length; i++) { actual.push(attributes.item(i).name); } assert.deepEqual(actual, ["title", "class"]); }); /** * Retrieve the first Element Node(Root Node) of the DOM object and check the string returned by the "getNodeName()" method. It should be equal to its tagName. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D095 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=251 */ specify("hc_nodeelementnodename", () => { let doc = hc_staff.hc_staff(); assert.equal(doc.documentElement.nodeName, "HTML"); }); /** * The "getNodeType()" method for an Element Node returns the constant value 1. Retrieve the root node and invoke the "getNodeType()" method. The method should return 1. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-111237558 */ specify("hc_nodeelementnodetype", () => { let success; let doc; let rootNode; let nodeType; doc = hc_staff.hc_staff(); rootNode = doc.documentElement; nodeType = rootNode.nodeType; assert.equal(nodeType, 1, "nodeElementNodeTypeAssert1"); }); /** * The string returned by the "getNodeValue()" method for an Element Node is null. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D080 */ specify("hc_nodeelementnodevalue", () => { let success; let doc; let elementNode; let elementValue; doc = hc_staff.hc_staff(); elementNode = doc.documentElement; elementValue = elementNode.nodeValue; assert.equal(elementValue, null, "elementNodeValue"); }); /** * The "getFirstChild()" method returns the first child of this node. Retrieve the second employee and invoke the "getFirstChild()" method. The NodeName returned should be "#text" or "EM". * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-169727388 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=246 */ specify("hc_nodegetfirstchild", () => { let doc = hc_staff.hc_staff(); let fchildNode = doc.getElementsByTagName("p").item(1).firstChild; assert.equal(fchildNode.nodeName, "#text", "firstChild_w_whitespace"); }); /** * If there is not a first child then the "getFirstChild()" method returns null. Retrieve the text of the first "em" element and invoke the "getFirstChild()" method. It should return null. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-169727388 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=246 */ specify("hc_nodegetfirstchildnull", () => { let doc = hc_staff.hc_staff(); let emText = doc.getElementsByTagName("em").item(0).firstChild; assert.equal(emText.firstChild, null, "nullChild"); }); /** * The "getLastChild()" method returns the last child of this node. Retrieve the second employee and invoke the "getLastChild()" method. The NodeName returned should be "#text". * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-61AD09FB */ specify("hc_nodegetlastchild", () => { let success; let doc; let elementList; let employeeNode; let lchildNode; let childName; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("p"); employeeNode = elementList.item(1); lchildNode = employeeNode.lastChild; childName = lchildNode.nodeName; assert.equal(childName, "#text", "whitespace"); }); /** * If there is not a last child then the "getLastChild()" method returns null. Retrieve the text of the first "em" element and invoke the "getFirstChild()" method. It should return null. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-61AD09FB * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=246 */ specify("hc_nodegetlastchildnull", () => { let success; let doc; let emList; let emNode; let emText; let nullChild; doc = hc_staff.hc_staff(); emList = doc.getElementsByTagName("em"); emNode = emList.item(0); emText = emNode.firstChild; nullChild = emText.lastChild; assert.equal(nullChild, null, "nullChild"); }); /** * The "getNextSibling()" method returns the node immediately following this node. Retrieve the first child of the second employee and invoke the "getNextSibling()" method. It should return a node with the NodeName of "#text". * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-6AC54C2F */ specify("hc_nodegetnextsibling", () => { let success; let doc; let elementList; let emNode; let nsNode; let nsName; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("em"); emNode = elementList.item(1); nsNode = emNode.nextSibling; nsName = nsNode.nodeName; assert.equal(nsName, "#text", "whitespace"); }); /** * If there is not a node immediately following this node the "getNextSibling()" method returns null. Retrieve the first child of the second employee and invoke the "getNextSibling()" method. It should be set to null. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-6AC54C2F */ specify("hc_nodegetnextsiblingnull", () => { let success; let doc; let elementList; let employeeNode; let lcNode; let nsNode; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("p"); employeeNode = elementList.item(1); lcNode = employeeNode.lastChild; nsNode = lcNode.nextSibling; assert.equal(nsNode, null, "nodeGetNextSiblingNullAssert1"); }); /** * Evaluate Node.ownerDocument on the second "p" element. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#node-ownerDoc * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=251 */ specify("hc_nodegetownerdocument", () => { let doc = hc_staff.hc_staff(); let elementName = doc.getElementsByTagName("p").item(1).ownerDocument.documentElement.nodeName; assert.equal(elementName, "HTML"); }); /** * The "getOwnerDocument()" method returns null if the target node itself is a document. Invoke the "getOwnerDocument()" method on the master document. The Document returned should be null. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#node-ownerDoc */ specify("hc_nodegetownerdocumentnull", () => { let success; let doc; let ownerDocument; doc = hc_staff.hc_staff(); ownerDocument = doc.ownerDocument; assert.equal(ownerDocument, null, "nodeGetOwnerDocumentNullAssert1"); }); /** * The "getPreviousSibling()" method returns the node immediately preceding this node. Retrieve the second child of the second employee and invoke the "getPreviousSibling()" method. It should return a node with a NodeName of "#text". * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-640FB3C8 */ specify("hc_nodegetprevioussibling", () => { let success; let doc; let elementList; let nameNode; let psNode; let psName; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("strong"); nameNode = elementList.item(1); psNode = nameNode.previousSibling; psName = psNode.nodeName; assert.equal(psName, "#text", "whitespace"); }); /** * If there is not a node immediately preceding this node the "getPreviousSibling()" method returns null. Retrieve the first child of the second employee and invoke the "getPreviousSibling()" method. It should be set to null. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-640FB3C8 */ specify("hc_nodegetprevioussiblingnull", () => { let success; let doc; let elementList; let employeeNode; let fcNode; let psNode; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("p"); employeeNode = elementList.item(2); fcNode = employeeNode.firstChild; psNode = fcNode.previousSibling; assert.equal(psNode, null, "nodeGetPreviousSiblingNullAssert1"); }); /** * The "hasChildNodes()" method returns true if the node has children. Retrieve the root node("staff") and invoke the "hasChildNodes()" method. It should return the boolean value "true". * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-810594187 */ specify("hc_nodehaschildnodes", () => { let success; let doc; let elementList; let employeeNode; let state; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("p"); employeeNode = elementList.item(1); state = employeeNode.hasChildNodes(); assert.ok(state, "nodeHasChildAssert1"); }); /** * The "hasChildNodes()" method returns false if the node does not have any children. Retrieve the text of the first "em" element and invoke the "hasChildNodes()" method. It should return false. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1451460987 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-810594187 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=246 */ specify("hc_nodehaschildnodesfalse", () => { let success; let doc; let emList; let emNode; let emText; let hasChild; doc = hc_staff.hc_staff(); emList = doc.getElementsByTagName("em"); emNode = emList.item(0); emText = emNode.firstChild; hasChild = emText.hasChildNodes(); assert.equal(hasChild, false, "hasChild"); }); /** * The "insertBefore(newChild,refChild)" method inserts the node "newChild" before the node "refChild". Insert a newly created Element node before the second sup element in the document and check the "newChild" and "refChild" after insertion for correct placement. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-952280727 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=246 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=247 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=261 */ specify("hc_nodeinsertbefore", () => { let success; let doc; let elementList; let employeeNode; let childList; let refChild; let newChild; let child; let childName; let insertedNode; let actual = new Array(); let expected = ["EM", "STRONG", "CODE", "BR", "SUP", "VAR", "ACRONYM"]; let nodeType; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("sup"); refChild = elementList.item(2); employeeNode = refChild.parentNode; childList = employeeNode.childNodes; newChild = doc.createElement("br"); insertedNode = employeeNode.insertBefore(newChild, refChild); for (let indexN10091 = 0; indexN10091 < childList.length; indexN10091++) { child = childList.item(indexN10091); nodeType = child.nodeType; if ( (nodeType === 1) ) { childName = child.nodeName; actual[actual.length] = childName; } } assert.deepEqual(actual, expected, "element nodeNames"); }); /** * If the "newChild" is a DocumentFragment object then all its children are inserted in the same order before the the "refChild". Create a DocumentFragment object and populate it with two Element nodes. Retrieve the second employee and insert the newly created DocumentFragment before its fourth child. The second employee should now have two extra children("newChild1" and "newChild2") at positions fourth and fifth respectively. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-952280727 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=247 */ specify("hc_nodeinsertbeforedocfragment", () => { let doc = hc_staff.hc_staff(); let employeeNode = doc.getElementsByTagName("p").item(1); let refChild = employeeNode.childNodes.item(3); let newdocFragment = doc.createDocumentFragment(); newdocFragment.appendChild(doc.createElement("br")); newdocFragment.appendChild(doc.createElement("b")); employeeNode.insertBefore(newdocFragment, refChild); assert.equal(employeeNode.childNodes.item(3).nodeName, "BR", "element childName3"); assert.equal(employeeNode.childNodes.item(4).nodeName, "B", "element childName4"); }); /** * If the "newChild" is already in the tree, the "insertBefore(newChild,refChild)" method must first remove it before the insertion takes place. Insert a node Element ("em") that is already present in the tree. The existing node should be removed first and the new one inserted. The node is inserted at a different position in the tree to assure that it was indeed inserted. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-952280727 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=246 */ specify("hc_nodeinsertbeforenewchildexists", () => { let success; let doc; let elementList; let employeeNode; let childList; let refChild; let newChild; let child; let childName; let insertedNode; let expected = ["STRONG", "CODE", "SUP", "VAR", "EM", "ACRONYM"]; let result = new Array(); let nodeType; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("p"); employeeNode = elementList.item(1); childList = employeeNode.getElementsByTagName("*"); refChild = childList.item(5); newChild = childList.item(0); insertedNode = employeeNode.insertBefore(newChild, refChild); for (let indexN1008C = 0; indexN1008C < childList.length; indexN1008C++) { child = childList.item(indexN1008C); nodeType = child.nodeType; if ( (nodeType === 1) ) { childName = child.nodeName; result[result.length] = childName; } } assert.deepEqual(result, expected, "element childNames"); }); /** * The "insertBefore(newChild,refChild)" method raises a HIERARCHY_REQUEST_ERR DOMException if the node to be inserted is one of this nodes ancestors. Retrieve the second employee and attempt to insert a node that is one of its ancestors(root node). An attempt to insert such a node should raise the desired exception. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='HIERARCHY_REQUEST_ERR']) * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-952280727 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-952280727')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='HIERARCHY_REQUEST_ERR']) * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-952280727 */ specify("hc_nodeinsertbeforenodeancestor", () => { let doc = hc_staff.hc_staff(); let newChild = doc.documentElement; let employeeNode = doc.getElementsByTagName("p").item(1); let refChild = employeeNode.childNodes.item(0); let success = false; try { employeeNode.insertBefore(newChild, refChild); } catch (ex) { success = (typeof (ex.code) !== "undefined" && ex.code === 3); } assert.ok(success, "throw_HIERARCHY_REQUEST_ERR"); }); /** * The "insertBefore(newChild,refchild)" method returns the node being inserted. Insert an Element node before the fourth child of the second employee and check the node returned from the "insertBefore(newChild,refChild)" method. The node returned should be "newChild". * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D095 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-952280727 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=247 */ specify("hc_nodeinsertbeforenodename", () => { let doc = hc_staff.hc_staff(); let employeeNode = doc.getElementsByTagName("p").item(1); let refChild = employeeNode.childNodes.item(3); let newChild = doc.createElement("br"); let insertedNode = employeeNode.insertBefore(newChild, refChild); assert.equal(insertedNode.nodeName, "BR", "element nodeName"); }); /** * The "insertBefore(newChild,refChild)" method raises a NOT_FOUND_ERR DOMException if the reference child is not a child of this node. Retrieve the second employee and attempt to insert a new node before a reference node that is not a child of this node. An attempt to insert before a non child node should raise the desired exception. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='NOT_FOUND_ERR']) * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-952280727 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-952280727')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NOT_FOUND_ERR']) * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-952280727 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=247 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=249 */ specify("hc_nodeinsertbeforerefchildnonexistent", () => { let doc = hc_staff.hc_staff(); let newChild = doc.createElement("br"); let refChild = doc.createElement("b"); let elementNode = doc.getElementsByTagName("p").item(1); let success = false; try { elementNode.insertBefore(newChild, refChild); } catch (ex) { success = (typeof (ex.code) !== "undefined" && ex.code === 8); } assert.ok(success, "throw_NOT_FOUND_ERR"); }); /** * If the "refChild" is null then the "insertBefore(newChild,refChild)" method inserts the node "newChild" at the end of the list of children. Retrieve the second employee and invoke the "insertBefore(newChild,refChild)" method with refChild=null. Since "refChild" is null the "newChild" should be added to the end of the list. The last item in the list is checked after insertion. The last Element node of the list should be "newChild". * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-952280727 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=247 */ specify("hc_nodeinsertbeforerefchildnull", () => { let refChild = null; let doc = hc_staff.hc_staff(); let employeeNode = doc.getElementsByTagName("p").item(1); let newChild = doc.createElement("br"); employeeNode.insertBefore(newChild, refChild); assert.equal(employeeNode.lastChild.nodeName, "BR", "element nodeName"); }); /** * Create a list of all the children elements of the third employee and access its first child by using an index of 0. This should result in the whitspace before "em" being selected (em when ignoring whitespace). Further we evaluate its content(by using the "getNodeName()" method) to ensure the proper element was accessed. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-844377136 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=246 */ specify("hc_nodelistindexequalzero", () => { let doc = hc_staff.hc_staff(); let employeeList = doc.getElementsByTagName("p").item(2).childNodes; assert.equal(employeeList.item(0).nodeName, "#text", "childName_w_whitespace"); }); /** * The "getLength()" method returns the number of nodes in the list. Create a list of all the children elements of the third employee and invoke the "getLength()" method. It should contain the value 13. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-203510337 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=246 */ specify("hc_nodelistindexgetlength", () => { let success; let doc; let elementList; let employeeNode; let employeeList; let length; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("p"); employeeNode = elementList.item(2); employeeList = employeeNode.childNodes; length = employeeList.length; if ( (length === 6) ) { assert.equal(length, 6, "length_wo_space"); } else { assert.equal(length, 13, "length_w_space"); } }); /** * The "getLength()" method returns the number of nodes in the list.(Test for EMPTY list) Create a list of all the children of the Text node inside the first child of the third employee and invoke the "getLength()" method. It should contain the value 0. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-203510337 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=246 */ specify("hc_nodelistindexgetlengthofemptylist", () => { let success; let doc; let emList; let emNode; let textNode; let textList; let length; doc = hc_staff.hc_staff(); emList = doc.getElementsByTagName("em"); emNode = emList.item(2); textNode = emNode.firstChild; textList = textNode.childNodes; length = textList.length; assert.equal(length, 0, "length"); }); /** * The items in the list are accessible via an integral index starting from zero. (Index not equal 0) Create a list of all the children elements of the third employee and access its fourth child by using an index of 3 and calling getNodeName() which should return "strong" (no whitespace) or "#text" (with whitespace). * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-844377136 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=246 */ specify("hc_nodelistindexnotzero", () => { let doc = hc_staff.hc_staff(); let child = doc.getElementsByTagName("p").item(2).childNodes.item(3); assert.equal(child.nodeName, "STRONG", "element childName_strong"); }); /** * Create a list of all the children elements of the third employee and access its first child by invoking the "item(index)" method with an index=0. This should result in node with a nodeName of "#text" or "em". * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-844377136 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=246 */ specify("hc_nodelistreturnfirstitem", () => { let doc = hc_staff.hc_staff(); let child = doc.getElementsByTagName("p").item(2).childNodes.item(0); assert.equal(child.nodeName, "#text", "nodeName_w_space"); }); /** * Create a list of all the children elements of the third employee and access its last child by invoking the "item(index)" method with an index=length-1. This should result in node with nodeName="#text" or acronym. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-844377136 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=246 */ specify("hc_nodelistreturnlastitem", () => { let doc = hc_staff.hc_staff(); let employeeList = doc.getElementsByTagName("p").item(2).childNodes; let child = employeeList.item(employeeList.length - 1); assert.equal(child.nodeName, "#text", "lastNodeName_w_whitespace"); }); /** * The range of valid child node indices is 0 thru length -1 Create a list of all the children elements of the third employee and traverse the list from index=0 thru length -1. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-203510337 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-844377136 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=246 */ specify("hc_nodelisttraverselist", () => { let success; let doc; let elementList; let employeeNode; let employeeList; let child; let childName; let nodeType; let result = new Array(); let expected = ["EM", "STRONG", "CODE", "SUP", "VAR", "ACRONYM"]; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("p"); employeeNode = elementList.item(2); employeeList = employeeNode.childNodes; for (let indexN10073 = 0; indexN10073 < employeeList.length; indexN10073++) { child = employeeList.item(indexN10073); nodeType = child.nodeType; childName = child.nodeName; if ( (nodeType === 1) ) { result[result.length] = childName; } else { assert.equal(nodeType, 3, "textNodeType"); assert.equal(childName, "#text", "textNodeName"); } } assert.deepEqual(result, expected, "element nodeNames"); }); /** * The "getParentNode()" method returns the parent of this node. Retrieve the second employee and invoke the "getParentNode()" method on this node. It should be set to "body". * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1060184317 */ specify("hc_nodeparentnode", () => { let doc = hc_staff.hc_staff(); let parentNode = doc.getElementsByTagName("p").item(1).parentNode; assert.equal(parentNode.nodeName, "BODY", "element parentNodeName"); }); /** * The "getParentNode()" method invoked on a node that has just been created and not yet added to the tree is null. Create a new "employee" Element node using the "createElement(name)" method from the Document interface. Since this new node has not yet been added to the tree, the "getParentNode()" method will return null. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1060184317 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=247 */ specify("hc_nodeparentnodenull", () => { let success; let doc; let createdNode; let parentNode; doc = hc_staff.hc_staff(); createdNode = doc.createElement("br"); parentNode = createdNode.parentNode; assert.equal(parentNode, null, "parentNode"); }); /** * The "removeChild(oldChild)" method removes the child node indicated by "oldChild" from the list of children and returns it. Remove the first employee by invoking the "removeChild(oldChild)" method an checking the node returned by the "getParentNode()" method. It should be set to null. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1734834066 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=249 */ specify("hc_noderemovechild", () => { let success; let doc; let rootNode; let childList; let childToRemove; let removedChild; let parentNode; doc = hc_staff.hc_staff(); rootNode = doc.documentElement; childList = rootNode.childNodes; childToRemove = childList.item(1); removedChild = rootNode.removeChild(childToRemove); parentNode = removedChild.parentNode; assert.equal(parentNode, null, "parentNodeNull"); }); /** * The "removeChild(oldChild)" method returns the node being removed. Remove the first child of the second employee and check the NodeName returned by the "removeChild(oldChild)" method. The returned node should have a NodeName equal to "#text". * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D095 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1734834066 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=246 */ specify("hc_noderemovechildgetnodename", () => { let success; let doc; let elementList; let employeeNode; let childList; let oldChild; let removedChild; let childName; let oldName; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("p"); employeeNode = elementList.item(1); childList = employeeNode.childNodes; oldChild = childList.item(0); oldName = oldChild.nodeName; removedChild = employeeNode.removeChild(oldChild); assert.notEqual(removedChild, null, "notnull"); childName = removedChild.nodeName; assert.equal(childName, oldName, "nodeName"); }); /** * The "removeChild(oldChild)" method removes the node indicated by "oldChild". Retrieve the second p element and remove its first child. After the removal, the second p element should have 5 element children and the first child should now be the child that used to be at the second position in the list. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1734834066 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=246 */ specify("hc_noderemovechildnode", () => { let doc = hc_staff.hc_staff(); let employeeNode = doc.getElementsByTagName("p").item(1); let childList = employeeNode.childNodes; let oldChild = employeeNode.getElementsByTagName("em").item(0); let removedChild = employeeNode.removeChild(oldChild); assert.equal(removedChild.nodeName, "EM", "element removedName"); let actual = []; for (let i = 0; i < childList.length; i++) { if (childList.item(i).nodeType === 1) { actual.push(childList.item(i).nodeName); } else { assert.equal(childList.item(i).nodeType, 3, "textNodeType"); assert.equal(childList.item(i).nodeName, "#text", "textNodeName"); } } assert.deepEqual(actual, ["STRONG", "CODE", "SUP", "VAR", "ACRONYM"], "element childNames"); }); /** * The "removeChild(oldChild)" method raises a NOT_FOUND_ERR DOMException if the old child is not a child of this node. Retrieve the second employee and attempt to remove a node that is not one of its children. An attempt to remove such a node should raise the desired exception. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='NOT_FOUND_ERR']) * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1734834066 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-1734834066')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NOT_FOUND_ERR']) * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1734834066 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=247 */ specify("hc_noderemovechildoldchildnonexistent", () => { let doc = hc_staff.hc_staff(); let oldChild = doc.createElement("br"); let elementNode = doc.getElementsByTagName("p").item(1); let success = false; try { elementNode.removeChild(oldChild); } catch (ex) { success = (typeof (ex.code) !== "undefined" && ex.code === 8); } assert.ok(success, "throw_NOT_FOUND_ERR"); }); /** * The "replaceChild(newChild,oldChild)" method replaces the node "oldChild" with the node "newChild". Replace the first element of the second employee with a newly created Element node. Check the first position after the replacement operation is completed. The new Element should be "newChild". * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-785887307 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=247 */ specify("hc_nodereplacechild", () => { let doc = hc_staff.hc_staff(); let employeeNode = doc.getElementsByTagName("p").item(1); let oldChild = employeeNode.childNodes.item(0); let newChild = doc.createElement("br"); employeeNode.replaceChild(newChild, oldChild); let child = employeeNode.childNodes.item(0); assert.equal(child.nodeName, "BR", "element nodeName"); }); /** * If the "newChild" is already in the tree, it is first removed before the new one is added. Retrieve the second "p" and replace "acronym" with its "em". * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-785887307 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=246 */ specify("hc_nodereplacechildnewchildexists", () => { let actual = []; let expected = ["STRONG", "CODE", "SUP", "VAR", "EM"]; let doc = hc_staff.hc_staff(); let employeeNode = doc.getElementsByTagName("p").item(1); let childList = employeeNode.getElementsByTagName("*"); let newChild = childList.item(0); let oldChild = childList.item(5); let replacedChild = employeeNode.replaceChild(newChild, oldChild); assert.equal(replacedChild, oldChild, "return_value_same"); for (let i = 0; i < childList.length; i++) { if (childList.item(i).nodeType === 1) { actual.push(childList.item(i).nodeName); } else { assert.equal(childList.item(i).nodeType, 3, "textNodeType"); assert.equal(childList.item(i).nodeName, "#text", "textNodeName"); } } assert.deepEqual(actual, expected, "element childNames"); }); /** * The "replaceChild(newChild,oldChild)" method raises a HIERARCHY_REQUEST_ERR DOMException if the node to put in is one of this node's ancestors. Retrieve the second employee and attempt to replace one of its children with an ancestor node(root node). An attempt to make such a replacement should raise the desired exception. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='HIERARCHY_REQUEST_ERR']) * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-785887307 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-785887307')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='HIERARCHY_REQUEST_ERR']) * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-785887307 */ specify("hc_nodereplacechildnodeancestor", () => { let doc = hc_staff.hc_staff(); let newChild = doc.documentElement; let employeeNode = doc.getElementsByTagName("p").item(1); let oldChild = employeeNode.childNodes.item(0); let success = false; try { employeeNode.replaceChild(newChild, oldChild); } catch (ex) { success = (typeof (ex.code) !== "undefined" && ex.code === 3); } assert.ok(success, "throw_HIERARCHY_REQUEST_ERR"); }); /** * The "replaceChild(newChild,oldChild)" method returns the node being replaced. Replace the second Element of the second employee with a newly created node Element and check the NodeName returned by the "replaceChild(newChild,oldChild)" method. The returned node should have a NodeName equal to "em". * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D095 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-785887307 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=247 */ specify("hc_nodereplacechildnodename", () => { let doc = hc_staff.hc_staff(); let employeeNode = doc.getElementsByTagName("p").item(1); let oldChild = employeeNode.getElementsByTagName("em").item(0); let newChild = doc.createElement("br"); let replacedNode = employeeNode.replaceChild(newChild, oldChild); assert.equal(replacedNode.nodeName, "EM", "element replacedNodeName"); }); /** * The "replaceChild(newChild,oldChild)" method raises a NOT_FOUND_ERR DOMException if the old child is not a child of this node. Retrieve the second employee and attempt to replace a node that is not one of its children. An attempt to replace such a node should raise the desired exception. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='NOT_FOUND_ERR']) * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-785887307 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-785887307')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NOT_FOUND_ERR']) * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-785887307 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=247 */ specify("hc_nodereplacechildoldchildnonexistent", () => { let doc = hc_staff.hc_staff(); let newChild = doc.createElement("br"); let oldChild = doc.createElement("b"); let elementNode = doc.getElementsByTagName("p").item(1); let success = false; try { elementNode.replaceChild(newChild, oldChild); } catch (ex) { success = (typeof (ex.code) !== "undefined" && ex.code === 8); } assert.ok(success, "throw_NOT_FOUND_ERR"); }); /** * The "getAttributes()" method invoked on a Text Node returns null. Retrieve the Text node from the last child of the first employee and invoke the "getAttributes()" method on the Text Node. It should return null. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-84CF096 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1312295772 */ specify("hc_nodetextnodeattribute", () => { let success; let doc; let elementList; let testAddr; let textNode; let attrList; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("acronym"); testAddr = elementList.item(0); textNode = testAddr.firstChild; attrList = textNode.attributes; assert.equal(attrList, null, "text_attributes_is_null"); }); /** * The string returned by the "getNodeName()" method for a Text Node is "#text". * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D095 */ specify("hc_nodetextnodename", () => { let success; let doc; let elementList; let testAddr; let textNode; let textName; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("acronym"); testAddr = elementList.item(0); textNode = testAddr.firstChild; textName = textNode.nodeName; assert.equal(textName, "#text", "textNodeName"); }); /** * The "getNodeType()" method for a Text Node returns the constant value 3. Retrieve the Text node from the last child of the first employee and invoke the "getNodeType()" method. The method should return 3. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-111237558 */ specify("hc_nodetextnodetype", () => { let success; let doc; let elementList; let testAddr; let textNode; let nodeType; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("acronym"); testAddr = elementList.item(0); textNode = testAddr.firstChild; nodeType = textNode.nodeType; assert.equal(nodeType, 3, "nodeTextNodeTypeAssert1"); }); /** * The string returned by the "getNodeValue()" method for a Text Node is the content of the Text node. Retrieve the Text node from the last child of the first employee and check the string returned by the "getNodeValue()" method. It should be equal to "1230 North Ave. Dallas, Texas 98551". * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D080 */ specify("hc_nodetextnodevalue", () => { let success; let doc; let elementList; let testAddr; let textNode; let textValue; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("acronym"); testAddr = elementList.item(0); textNode = testAddr.firstChild; textValue = textNode.nodeValue; assert.equal(textValue, "1230 North Ave. Dallas, Texas 98551", "textNodeValue"); }); /** * An element is created, setNodeValue is called with a non-null argument, but getNodeValue should still return null. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D080 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#i-Document */ specify("hc_nodevalue01", () => { let success; let doc; let newNode; let newValue; doc = hc_staff.hc_staff(); newNode = doc.createElement("acronym"); newValue = newNode.nodeValue; assert.equal(newValue, null, "initiallyNull"); newNode.nodeValue = "This should have no effect"; newValue = newNode.nodeValue; assert.equal(newValue, null, "nullAfterAttemptedChange"); }); /** * An comment is created, setNodeValue is called with a non-null argument, but getNodeValue should still return null. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D080 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1728279322 */ specify("hc_nodevalue02", () => { let success; let doc; let newNode; let newValue; doc = hc_staff.hc_staff(); newNode = doc.createComment("This is a new Comment node"); newValue = newNode.nodeValue; assert.equal(newValue, "This is a new Comment node", "initial"); newNode.nodeValue = "This should have an effect"; newValue = newNode.nodeValue; assert.equal(newValue, "This should have an effect", "afterChange"); }); /** * An document type accessed, setNodeValue is called with a non-null argument, but getNodeValue should still return null. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D080 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-B63ED1A31 */ specify("hc_nodevalue04", () => { let doc = hc_staff.hc_staff(); let newNode = doc.doctype; assert.notEqual(newNode, null, "docTypeNotNullOrDocIsHTML"); assert.notEqual(newNode, null, "docTypeNotNull"); assert.equal(newNode.nodeValue, null, "initiallyNull"); newNode.nodeValue = "This should have no effect"; assert.equal(newNode.nodeValue, null, "nullAfterAttemptedChange"); }); /** * A document fragment is created, setNodeValue is called with a non-null argument, but getNodeValue should still return null. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D080 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-B63ED1A3 */ specify("hc_nodevalue05", () => { let success; let doc; let newNode; let newValue; doc = hc_staff.hc_staff(); newNode = doc.createDocumentFragment(); newValue = newNode.nodeValue; assert.equal(newValue, null, "initiallyNull"); newNode.nodeValue = "This should have no effect"; newValue = newNode.nodeValue; assert.equal(newValue, null, "nullAfterAttemptedChange"); }); /** * An document is accessed, setNodeValue is called with a non-null argument, but getNodeValue should still return null. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D080 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#i-Document */ specify("hc_nodevalue06", () => { let success; let newNode; let newValue; newNode = hc_staff.hc_staff(); newValue = newNode.nodeValue; assert.equal(newValue, null, "initiallyNull"); newNode.nodeValue = "This should have no effect"; newValue = newNode.nodeValue; assert.equal(newValue, null, "nullAfterAttemptedChange"); }); /** * The "splitText(offset)" method raises an INDEX_SIZE_ERR DOMException if the specified offset is negative. Retrieve the textual data from the second child of the third employee and invoke the "splitText(offset)" method. The desired exception should be raised since the offset is a negative number. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INDEX_SIZE_ERR']) * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-38853C1D * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-38853C1D')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INDEX_SIZE_ERR']) */ specify("hc_textindexsizeerrnegativeoffset", () => { let doc = hc_staff.hc_staff(); let textNode = doc.getElementsByTagName("strong").item(2).firstChild; let success = false; try { textNode.splitText(-69); } catch (ex) { success = (typeof (ex.code) !== "undefined" && ex.code === 1); } assert.ok(success, "throws_INDEX_SIZE_ERR"); }); /** * The "splitText(offset)" method raises an INDEX_SIZE_ERR DOMException if the specified offset is greater than the number of characters in the Text node. Retrieve the textual data from the second child of the third employee and invoke the "splitText(offset)" method. The desired exception should be raised since the offset is a greater than the number of characters in the Text node. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INDEX_SIZE_ERR']) * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-38853C1D * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-38853C1D')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INDEX_SIZE_ERR']) * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=249 */ specify("hc_textindexsizeerroffsetoutofbounds", () => { let doc = hc_staff.hc_staff(); let textNode = doc.getElementsByTagName("strong").item(2).firstChild; let success = false; try { textNode.splitText(300); } catch (ex) { success = (typeof (ex.code) !== "undefined" && ex.code === 1); } assert.ok(success, "throw_INDEX_SIZE_ERR"); }); /** * Retrieve the textual data from the last child of the second employee. That node is composed of two EntityReference nodes and two Text nodes. After the content node is parsed, the "acronym" Element should contain four children with each one of the EntityReferences containing one child. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1451460987 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-11C98490 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-745549614 */ specify("hc_textparseintolistofelements", () => { let expectedNormal = ["β", " Dallas, ", "γ", "\n 98554"]; let expectedExpanded = ["β Dallas, γ\n 98554"]; let doc = hc_staff.hc_staff(); let childList = doc.getElementsByTagName("acronym").item(1).childNodes; let actual = []; for (let i = 0; i < childList.length; i++) { if (childList.item(i).nodeValue === null) { assert.notEqual(childList.item(i).firstChild, null, "grandChildNotNull"); actual.push(childList.item(i).firstChild.nodeValue); } else { actual.push(childList.item(i).nodeValue); } } if (childList.length === 1) { assert.deepEqual(actual, expectedExpanded, "assertEqCoalescing"); } else { assert.deepEqual(actual, expectedNormal, "assertEqNormal"); } }); /** * The "splitText(offset)" method returns the new Text node. Retrieve the textual data from the last child of the first employee and invoke the "splitText(offset)" method. The method should return the new Text node. The offset value used for this test is 30. The "getNodeValue()" method is called to check that the new node now contains the characters at and after position 30. (Starting count at 0) * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-38853C1D */ specify("hc_textsplittextfour", () => { let success; let doc; let elementList; let addressNode; let textNode; let splitNode; let value; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("acronym"); addressNode = elementList.item(0); textNode = addressNode.firstChild; splitNode = textNode.splitText(30); value = splitNode.nodeValue; assert.equal(value, "98551", "textSplitTextFourAssert"); }); /** * The "splitText(offset)" method breaks the Text node into two Text nodes at the specified offset keeping each node as siblings in the tree. Retrieve the textual data from the second child of the third employee and invoke the "splitText(offset)" method. The method splits the Text node into two new sibling Text nodes keeping both of them in the tree. This test checks the "nextSibling()" method of the original node to ensure that the two nodes are indeed siblings. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-38853C1D */ specify("hc_textsplittextone", () => { let success; let doc; let elementList; let nameNode; let textNode; let splitNode; let secondPart; let value; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("strong"); nameNode = elementList.item(2); textNode = nameNode.firstChild; splitNode = textNode.splitText(7); secondPart = textNode.nextSibling; value = secondPart.nodeValue; assert.equal(value, "Jones", "textSplitTextOneAssert"); }); /** * After the "splitText(offset)" method breaks the Text node into two Text nodes, the new Text node contains all the content at and after the offset point. Retrieve the textual data from the second child of the third employee and invoke the "splitText(offset)" method. The new Text node should contain all the content at and after the offset point. The "getNodeValue()" method is called to check that the new node now contains the characters at and after position seven. (Starting count at 0) * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-38853C1D */ specify("hc_textsplittextthree", () => { let success; let doc; let elementList; let nameNode; let textNode; let splitNode; let value; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("strong"); nameNode = elementList.item(2); textNode = nameNode.firstChild; splitNode = textNode.splitText(6); value = splitNode.nodeValue; assert.equal(value, " Jones", "textSplitTextThreeAssert"); }); /** * After the "splitText(offset)" method breaks the Text node into two Text nodes, the original node contains all the content up to the offset point. Retrieve the textual data from the second child of the third employee and invoke the "splitText(offset)" method. The original Text node should contain all the content up to the offset point. The "getNodeValue()" method is called to check that the original node now contains the first five characters. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-38853C1D */ specify("hc_textsplittexttwo", () => { let success; let doc; let elementList; let nameNode; let textNode; let splitNode; let value; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("strong"); nameNode = elementList.item(2); textNode = nameNode.firstChild; splitNode = textNode.splitText(5); value = textNode.nodeValue; assert.equal(value, "Roger", "textSplitTextTwoAssert"); }); /** * If there is not any markup inside an Element or Attr node content, then the text is contained in a single object implementing the Text interface that is the only child of the element. Retrieve the textual data from the second child of the third employee. That Text node contains a block of multiple text lines without markup, so they should be treated as a single Text node. The "getNodeValue()" method should contain the combination of the two lines. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1312295772 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D080 */ specify("hc_textwithnomarkup", () => { let success; let doc; let elementList; let nameNode; let nodeV; let value; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("strong"); nameNode = elementList.item(2); nodeV = nameNode.firstChild; value = nodeV.nodeValue; assert.equal(value, "Roger\n Jones", "textWithNoMarkupAssert"); }); }); jsdom-19.0.0/test/to-port-to-wpts/level1/html/000077500000000000000000000000001415223704400210515ustar00rootroot00000000000000jsdom-19.0.0/test/to-port-to-wpts/level1/html/files/000077500000000000000000000000001415223704400221535ustar00rootroot00000000000000jsdom-19.0.0/test/to-port-to-wpts/level1/html/files/hc_nodtdstaff.html.js000066400000000000000000000006741415223704400262710ustar00rootroot00000000000000"use strict"; const { JSDOM } = require("../../../../.."); exports.hc_nodtdstaff = function () { return (new JSDOM(` hc_nodtdstaff

EMP0001 Margaret Martin Accountant 56,000 Female 1230 North Ave. Dallas, Texas 98551

`)).window.document; }; jsdom-19.0.0/test/to-port-to-wpts/level1/html/files/hc_staff.html.js000066400000000000000000000030511415223704400252300ustar00rootroot00000000000000"use strict"; const { JSDOM } = require("../../../../.."); exports.hc_staff = function () { return (new JSDOM(` hc_staff

EMP0001 Margaret Martin Accountant 56,000 Female 1230 North Ave. Dallas, Texas 98551

EMP0002 Martha RaynoldsThis is a CDATASection with EntityReference number 2 &ent2; This is an adjacent CDATASection with a reference to a tab &tab; Secretary 35,000 Female β Dallas, γ 98554

EMP0003 Roger Jones Department Manager 100,000 δ PO Box 27 Irving, texas 98553

EMP0004 Jeny Oconnor Personnel Director 95,000 Female 27 South Road. Dallas, Texas 98556

EMP0005 Robert Myers Computer Specialist 90,000 male 1821 Nordic. Road, Irving Texas 98558

`)).window.document; }; jsdom-19.0.0/test/to-port-to-wpts/level2/000077500000000000000000000000001415223704400201065ustar00rootroot00000000000000jsdom-19.0.0/test/to-port-to-wpts/level2/core.js000066400000000000000000007064321415223704400214100ustar00rootroot00000000000000const { assert } = require("chai"); const { beforeEach, afterEach, describe, specify } = require("mocha-sugar-free"); describe("level2/core", () => { // NB: these tests have been modified to be compliant with the modern DOM, instead of the "DOM Level 2" they were // written for. Check the revision history. // The "getOwnerElement()" will return the Element node this attribute is attached to or null if this attribute is not in use. // @author IBM // @author Neil Delima // @see http://www.w3.org/TR/DOM-Level-2-Core/core#Attr-ownerElement describe('attrgetownerelement', () => { beforeEach(() => { this.doc = require('./core/files/staffNS.xml').staffNS(); }); afterEach(() => { delete(this.doc); }); // Create a new element and attribute node, attach the attribute to the element. Check the value of owner element of the new attribute node specify('attrgetownerelement02', () => { var element = this.doc.createElement("root"); var attr = this.doc.createAttributeNS("http://www.w3.org/DOM/L1","L1:att"); element.setAttributeNodeNS(attr); assert.equal(attr.ownerElement.nodeName.toLowerCase(), 'root'); }); // Create a new attribute node for this document node. Since the newly attribute is not in use its owner element should be null. specify('attrgetownerelement03', () => { var attr = this.doc.createAttributeNS("http://www.w3.org/DOM","dom:attr"); assert.equal(attr.ownerElement, null, 'should be null') }); // Retreive an element and its attributes. Then remove the element and check the name of the ownerElement of attribute of the attribute "street". // @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=259 specify('attrgetownerelement05', () => { var element = this.doc.getElementsByTagNameNS("*","address").item(1); element.parentNode.removeChild(element); var attr = element.attributes.getNamedItemNS(null, "street"); assert.equal(attr.ownerElement.nodeName, 'address'); }); }); describe('createAttributeNS', () => { /** * The "createAttributeNS(namespaceURI,qualifiedName)" method for a Document should raise NAMESPACE_ERR DOMException if qualifiedName is malformed. Invoke method createAttributeNS(namespaceURI,qualifiedName) on the XMLNS Document with namespaceURI being "http://www.ecommerce.org/", qualifiedName as "prefix::local". Method should raise NAMESPACE_ERR DOMException. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-258A00AF')/constant[@name='NAMESPACE_ERR']) * @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-DocCrAttrNS * @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-DocCrAttrNS')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NAMESPACE_ERR']) */ specify('createAttributeNS01', () => { var success; var namespaceURI = "http://www.ecommerce.org/"; var malformedName = "prefix::local"; var newAttr; var doc = require('./core/files/staffNS.xml').staffNS(); { success = false; try { newAttr = doc.createAttributeNS(namespaceURI,malformedName); } catch(ex) { success = (typeof(ex.code) != 'undefined' && ex.code == 5); } assert.ok(success, 'throw_INVALID_CHARACTER_ERR'); } }); /** * The "createAttributeNS(namespaceURI,qualifiedName)" method for a Document should raise NAMESPACE_ERR DOMException if qualifiedName has a prefix and namespaceURI is null. Invoke method createAttributeNS(namespaceURI,qualifiedName) on this document with namespaceURI being null and qualifiedName contains the prefix "person". Method should raise NAMESPACE_ERR DOMException. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-258A00AF')/constant[@name='NAMESPACE_ERR']) * @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-DocCrAttrNS * @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-DocCrAttrNS')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NAMESPACE_ERR']) */ specify('createAttributeNS02', () => { var success; var namespaceURI = null; var qualifiedName = "prefix:local"; var newAttr; var doc = require('./core/files/staffNS.xml').staffNS(); { success = false; try { newAttr = doc.createAttributeNS(namespaceURI,qualifiedName); } catch(ex) { success = (typeof(ex.code) != 'undefined' && ex.code == 14); } assert.ok(success, 'throw_NAMESPACE_ERR'); } }); /** * The "createAttributeNS(namespaceURI,qualifiedName)" method for a Document should raise INVALID_CHARACTER_ERR DOMException if qualifiedName contains an illegal character. Invoke method createAttributeNS(namespaceURI,qualifiedName) on this document with qualifiedName containing an illegal character from illegalChars[]. Method should raise INVALID_CHARACTER_ERR DOMException for all characters in illegalChars[]. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-DocCrAttrNS * @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-DocCrAttrNS')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INVALID_CHARACTER_ERR']) */ specify('createAttributeNS03', () => { var success; var namespaceURI = "http://www.wedding.com/"; var qualifiedName; var newAttr; illegalQNames = new Array(); illegalQNames[0] = "person:{"; illegalQNames[1] = "person:}"; illegalQNames[2] = "person:~"; illegalQNames[3] = "person:'"; illegalQNames[4] = "person:!"; illegalQNames[5] = "person:@"; illegalQNames[6] = "person:#"; illegalQNames[7] = "person:$"; illegalQNames[8] = "person:%"; illegalQNames[9] = "person:^"; illegalQNames[10] = "person:&"; illegalQNames[11] = "person:*"; illegalQNames[12] = "person:("; illegalQNames[13] = "person:)"; illegalQNames[14] = "person:+"; illegalQNames[15] = "person:="; illegalQNames[16] = "person:["; illegalQNames[17] = "person:]"; illegalQNames[18] = "person:\\"; illegalQNames[19] = "person:/"; illegalQNames[20] = "person:;"; illegalQNames[21] = "person:`"; illegalQNames[22] = "person:<"; illegalQNames[23] = "person:>"; illegalQNames[24] = "person:,"; illegalQNames[25] = "person:a "; illegalQNames[26] = "person:\""; var doc = require('./core/files/staffNS.xml').staffNS(); for(var indexN10090 = 0;indexN10090 < illegalQNames.length; indexN10090++) { qualifiedName = illegalQNames[indexN10090]; { success = false; try { newAttr = doc.createAttributeNS(namespaceURI,qualifiedName); } catch(ex) { success = (typeof(ex.code) != 'undefined' && ex.code == 5); } assert.ok(success, 'throw_INVALID_CHARACTER_ERR'); } } }); /** * The "createAttributeNS(namespaceURI,qualifiedName)" method for a Document should raise NAMESPACE_ERR DOMException if qualifiedName has the "xml" prefix and namespaceURI is different from "http://www.w3.org/XML/1998/namespace". Invoke method createAttributeNS(namespaceURI,qualifiedName) on this document with qualifiedName being "xml:attr1 and namespaceURI equals the string "http://www.w3.org/XML/1998/namespaces" (which differs from the required string "http://www.w3.org/XML/1998/namespace"). Method should raise NAMESPACE_ERR DOMException. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-258A00AF')/constant[@name='NAMESPACE_ERR']) * @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-DocCrAttrNS * @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-DocCrAttrNS')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NAMESPACE_ERR']) */ specify('createAttributeNS04', () => { var success; var namespaceURI = "http://www.w3.org/XML/1998/namespaces"; var qualifiedName = "xml:attr1"; var newAttr; var doc = require('./core/files/staffNS.xml').staffNS(); { success = false; try { newAttr = doc.createAttributeNS(namespaceURI,qualifiedName); } catch(ex) { success = (typeof(ex.code) != 'undefined' && ex.code == 14); } assert.ok(success, 'throw_NAMESPACE_ERR'); } }); /** * The "createAttributeNS(namespaceURI,qualifiedName)" method for a Document should return a new Attr object given that all parameters are valid and correctly formed. Invoke method createAttributeNS(namespaceURI,qualifiedName) on this document with parameters equal "http://www.ecommerce.org/" and "ecom:local" respectively. Method should return a new Attr object whose name is "ecom:local". * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-1112119403 */ specify('createAttributeNS05', () => { var success; var namespaceURI = "http://www.ecommerce.org/"; var qualifiedName = "econm:local"; var newAttr; var attrName; var doc = require('./core/files/staffNS.xml').staffNS(); newAttr = doc.createAttributeNS(namespaceURI,qualifiedName); attrName = newAttr.name; }); /** * Document.createAttributeNS with an empty qualified name should cause an INVALID_CHARACTER_ERR. * @author Curt Arnold * @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-DocCrAttrNS * @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-DocCrAttrNS')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INVALID_CHARACTER_ERR']) * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=525 */ specify('createAttributeNS06', () => { var success; var namespaceURI = "http://www.example.com/"; var qualifiedName; var newAttr; var doc = require('../level1/core/files/hc_staff.xml').hc_staff(); { success = false; try { newAttr = doc.createAttributeNS(namespaceURI,""); } catch(ex) { success = (typeof(ex.code) != 'undefined' && ex.code == 5); } assert.ok(success, 'throw_INVALID_CHARACTER_ERR'); } }); }); describe('createDocument', () => { /** * The "createDocument(namespaceURI,qualifiedName,doctype)" method for a DOMImplementation should raise NAMESPACE_ERR DOMException if parameter qualifiedName is malformed. Retrieve the DOMImplementation on the XMLNS Document. Invoke method createDocument(namespaceURI,qualifiedName,doctype) on the retrieved DOMImplementation with namespaceURI being the literal string "http://www.ecommerce.org/", qualifiedName as "prefix::local", and doctype as null. Method should raise NAMESPACE_ERR DOMException. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-258A00AF')/constant[@name='NAMESPACE_ERR']) * @see http://www.w3.org/TR/DOM-Level-2-Core/core#Level-2-Core-DOM-createDocument * @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('Level-2-Core-DOM-createDocument')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NAMESPACE_ERR']) */ specify('createDocument01', () => { var success; var namespaceURI = "http://www.ecommerce.org/"; var malformedName = "prefix::local"; var docType = null; var domImpl; var aNewDoc; var doc = require('./core/files/staffNS.xml').staffNS(); domImpl = doc.implementation; { success = false; try { aNewDoc = domImpl.createDocument(namespaceURI,malformedName,docType); } catch(ex) { success = (typeof(ex.code) != 'undefined' && ex.code == 5); } assert.ok(success, 'throw_INVALID_CHARACTER_ERR'); } }); /** * The "createDocument(namespaceURI,qualifiedName,doctype)" method for a DOMImplementation should raise NAMESPACE_ERR DOMException if qualifiedName has a prefix and namespaceURI is null. Invoke method createDocument(namespaceURI,qualifiedName,doctype) on this domimplementation with namespaceURI being null and qualifiedName equals "k:local". Method should raise NAMESPACE_ERR DOMException. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-258A00AF')/constant[@name='NAMESPACE_ERR']) * @see http://www.w3.org/TR/DOM-Level-2-Core/core#Level-2-Core-DOM-createDocument * @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('Level-2-Core-DOM-createDocument')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NAMESPACE_ERR']) */ specify('createDocument02', () => { var success; var namespaceURI = null; var qualifiedName = "k:local"; var docType = null; var domImpl; var aNewDoc; var doc = require('./core/files/staffNS.xml').staffNS(); domImpl = doc.implementation; { success = false; try { aNewDoc = domImpl.createDocument(namespaceURI,qualifiedName,docType); } catch(ex) { success = (typeof(ex.code) != 'undefined' && ex.code == 14); } assert.ok(success, 'throw_NAMESPACE_ERR'); } }); /** * The "createDocument(namespaceURI,qualifiedName,doctype)" method for a DOMImplementation should raise INVALID_CHARACTER_ERR DOMException if parameter qualifiedName contains an illegal character. Invoke method createDocument(namespaceURI,qualifiedName,doctype) on this domimplementation with namespaceURI equals "http://www.ecommerce.org/schema", doctype is null and qualifiedName contains an illegal character from illegalChars[]. Method should raise INVALID_CHARACTER_ERR DOMException for all characters in illegalChars[]. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/DOM-Level-2-Core/core# */ specify('createDocument05', () => { var success; var namespaceURI = "http://www.ecommerce.org/schema"; var qualifiedName; var docType = null; var domImpl; var aNewDoc; var charact; illegalQNames = new Array(); illegalQNames[0] = "namespaceURI:{"; illegalQNames[1] = "namespaceURI:}"; illegalQNames[2] = "namespaceURI:~"; illegalQNames[3] = "namespaceURI:'"; illegalQNames[4] = "namespaceURI:!"; illegalQNames[5] = "namespaceURI:@"; illegalQNames[6] = "namespaceURI:#"; illegalQNames[7] = "namespaceURI:$"; illegalQNames[8] = "namespaceURI:%"; illegalQNames[9] = "namespaceURI:^"; illegalQNames[10] = "namespaceURI:&"; illegalQNames[11] = "namespaceURI:*"; illegalQNames[12] = "namespaceURI:("; illegalQNames[13] = "namespaceURI:)"; illegalQNames[14] = "namespaceURI:+"; illegalQNames[15] = "namespaceURI:="; illegalQNames[16] = "namespaceURI:["; illegalQNames[17] = "namespaceURI:]"; illegalQNames[18] = "namespaceURI:\\"; illegalQNames[19] = "namespaceURI:/"; illegalQNames[20] = "namespaceURI:;"; illegalQNames[21] = "namespaceURI:`"; illegalQNames[22] = "namespaceURI:<"; illegalQNames[23] = "namespaceURI:>"; illegalQNames[24] = "namespaceURI:,"; illegalQNames[25] = "namespaceURI:a "; illegalQNames[26] = "namespaceURI:\""; var doc = require('./core/files/staffNS.xml').staffNS(); for(var indexN1009A = 0;indexN1009A < illegalQNames.length; indexN1009A++) { qualifiedName = illegalQNames[indexN1009A]; domImpl = doc.implementation; { success = false; try { aNewDoc = domImpl.createDocument(namespaceURI,qualifiedName,docType); } catch(ex) { success = (typeof(ex.code) != 'undefined' && ex.code == 5); } assert.ok(success, 'throw_INVALID_CHARACTER_ERR'); } } }); /** * The "createDocument(namespaceURI,qualifiedName,doctype)" method for a DOMImplementation should raise NAMESPACE_ERR DOMException if qualifiedName has the "xml" prefix and namespaceURI different from "http://www.w3.org/XML/1998/namespace" Invoke method createDocument(namespaceURI,qualifiedName,doctype) on this domimplementation with qualifiedName "xml:local" and namespaceURI as the string "http://www.ecommerce.org/schema" (which is different from the required "http://www.w3.org/XML/1998/namespace"). Method should raise NAMESPACE_ERR DOMException. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-258A00AF')/constant[@name='NAMESPACE_ERR']) * @see http://www.w3.org/TR/DOM-Level-2-Core/core#Level-2-Core-DOM-createDocument * @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('Level-2-Core-DOM-createDocument')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NAMESPACE_ERR']) */ specify('createDocument06', () => { var success; var namespaceURI = "http://ecommerce.org/schema"; var qualifiedName = "xml:local"; var docType = null; var domImpl; var aNewDoc; var doc = require('./core/files/staffNS.xml').staffNS(); domImpl = doc.implementation; { success = false; try { aNewDoc = domImpl.createDocument(namespaceURI,qualifiedName,docType); } catch(ex) { success = (typeof(ex.code) != 'undefined' && ex.code == 14); } assert.ok(success, 'throw_NAMESPACE_ERR'); } }); /** * The "createDocument(namespaceURI,qualifiedName,doctype)" method for a DOMImplementation should return a new xml Document object of the specified type with its document element given that all parameters are valid and correctly formed. Invoke method createDocument(namespaceURI,qualifiedName,doctype) on this domimplementation. namespaceURI is "http://www.ecommerce.org/schema" qualifiedName is "y:x" and doctype is null. Method should return a new xml Document as specified by the listed parameters. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/DOM-Level-2-Core/core#Level-2-Core-DOM-createDocument */ specify('createDocument07', () => { var success; var namespaceURI = "http://www.ecommerce.org/schema"; var qualifiedName = "y:x"; var docType = null; var domImpl; var aNewDoc; var nodeName; var nodeValue; var doc = require('./core/files/staffNS.xml').staffNS(); domImpl = doc.implementation; aNewDoc = domImpl.createDocument(namespaceURI,qualifiedName,docType); nodeName = aNewDoc.nodeName; nodeValue = aNewDoc.nodeValue; assert.equal(nodeName, "#document", "nodeName"); assert.equal(nodeValue, null, 'nodeValue should not be null'); }); /** * DOMImplementation.createDocument with an empty qualified name should not create a document element. * @author Curt Arnold * @see http://www.w3.org/TR/DOM-Level-2-Core/core# * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=525 */ specify('createDocument08', () => { var success; var namespaceURI = "http://www.example.org/schema"; var docType = null; var domImpl; var aNewDoc; var charact; var doc = require('./core/files/staffNS.xml').staffNS(); domImpl = doc.implementation; aNewDoc = domImpl.createDocument(namespaceURI,"",docType); assert.equal(aNewDoc.documentElement, null); }); }); describe('createDocumentType', () => { /** * The "createDocumentType(qualifiedName,publicId,systemId)" method for a DOMImplementation should raise NAMESPACE_ERR DOMException if qualifiedName is malformed. Retrieve the DOMImplementation on the XMLNS Document. Invoke method createDocumentType(qualifiedName,publicId,systemId) on the retrieved DOMImplementation with qualifiedName being the literal string "prefix::local", publicId as "STAFF", and systemId as "staff". Method should raise NAMESPACE_ERR DOMException. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-258A00AF')/constant[@name='NAMESPACE_ERR']) * @see http://www.w3.org/TR/DOM-Level-2-Core/core#Level-2-Core-DOM-createDocType * @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('Level-2-Core-DOM-createDocType')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NAMESPACE_ERR']) */ specify('createDocumentType01', () => { var success; var publicId = "STAFF"; var systemId = "staff.xml"; var malformedName = "prefix::local"; var domImpl; var newType; var doc = require('./core/files/staffNS.xml').staffNS(); domImpl = doc.implementation; { success = false; try { newType = domImpl.createDocumentType(malformedName,publicId,systemId); } catch(ex) { success = (typeof(ex.code) != 'undefined' && ex.code == 5); } assert.ok(success, 'throw_INVALID_CHARACTER_ERR'); } }); /** * The "createDocumentType(qualifiedName,publicId,systemId)" method for a DOMImplementation should raise INVALID_CHARACTER_ERR DOMException if qualifiedName contains an illegal character. Invoke method createDocumentType(qualifiedName,publicId,systemId) on this domimplementation with qualifiedName containing an illegal character from illegalChars[]. Method should raise INVALID_CHARACTER_ERR DOMException for all characters in illegalChars[]. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/DOM-Level-2-Core/core#Level-2-Core-DOM-createDocType * @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('Level-2-Core-DOM-createDocType')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INVALID_CHARACTER_ERR']) */ specify('createDocumentType02', () => { var success; var publicId = "http://www.localhost.com/"; var systemId = "myDoc.dtd"; var qualifiedName; var docType = null; var domImpl; illegalQNames = new Array(); illegalQNames[0] = "edi:{"; illegalQNames[1] = "edi:}"; illegalQNames[2] = "edi:~"; illegalQNames[3] = "edi:'"; illegalQNames[4] = "edi:!"; illegalQNames[5] = "edi:@"; illegalQNames[6] = "edi:#"; illegalQNames[7] = "edi:$"; illegalQNames[8] = "edi:%"; illegalQNames[9] = "edi:^"; illegalQNames[10] = "edi:&"; illegalQNames[11] = "edi:*"; illegalQNames[12] = "edi:("; illegalQNames[13] = "edi:)"; illegalQNames[14] = "edi:+"; illegalQNames[15] = "edi:="; illegalQNames[16] = "edi:["; illegalQNames[17] = "edi:]"; illegalQNames[18] = "edi:\\"; illegalQNames[19] = "edi:/"; illegalQNames[20] = "edi:;"; illegalQNames[21] = "edi:`"; illegalQNames[22] = "edi:<"; illegalQNames[23] = "edi:>"; illegalQNames[24] = "edi:,"; illegalQNames[25] = "edi:a "; illegalQNames[26] = "edi:\""; var doc = require('./core/files/staffNS.xml').staffNS(); for(var indexN1009A = 0;indexN1009A < illegalQNames.length; indexN1009A++) { qualifiedName = illegalQNames[indexN1009A]; domImpl = doc.implementation; { success = false; try { docType = domImpl.createDocumentType(qualifiedName,publicId,systemId); } catch(ex) { success = (typeof(ex.code) != 'undefined' && ex.code == 5); } assert.ok(success, 'throw_INVALID_CHARACTER_ERR'); } } }); /** * The "createDocumentType(qualifiedName,publicId,systemId)" method for a DOMImplementation should return a new DocumentType node given that qualifiedName is valid and correctly formed. Invoke method createDocumentType(qualifiedName,publicId,systemId) on this domimplementation with qualifiedName "prefix:myDoc". Method should return a new DocumentType node. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/DOM-Level-2-Core/core#Level-2-Core-DOM-createDocType */ specify('createDocumentType03', () => { var success; var namespaceURI = "http://ecommerce.org/schema"; var qualifiedName = "prefix:myDoc"; var publicId = "http://www.localhost.com"; var systemId = "myDoc.dtd"; var domImpl; var newType = null; var nodeName; var nodeValue; var doc = require('./core/files/staffNS.xml').staffNS(); domImpl = doc.implementation; newType = domImpl.createDocumentType(qualifiedName,publicId,systemId); nodeName = newType.nodeName; assert.equal(nodeName, "prefix:myDoc", "nodeName"); nodeValue = newType.nodeValue; assert.equal(nodeValue, null, 'nodeValue should not be null'); }); /** * DOMImplementation.createDocumentType with an empty name should cause an INVALID_CHARACTER_ERR. * @author Curt Arnold * @see http://www.w3.org/TR/DOM-Level-2-Core/core#Level-2-Core-DOM-createDocType * @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('Level-2-Core-DOM-createDocType')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INVALID_CHARACTER_ERR']) * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=525 */ specify('createDocumentType04', () => { var success; var publicId = "http://www.example.com/"; var systemId = "myDoc.dtd"; var qualifiedName; var docType = null; var domImpl = require('./core/files/staffNS.xml').staffNS().implementation; { success = false; try { docType = domImpl.createDocumentType("",publicId,systemId); } catch(ex) { success = (typeof(ex.code) != 'undefined' && ex.code == 5); } assert.ok(success, 'throw_INVALID_CHARACTER_ERR'); } }); }); describe('createElementNS', () => { /** * The "createElementNS(namespaceURI,qualifiedName)" method for a Document should raise NAMESPACE_ERR DOMException if qualifiedName is malformed. Invoke method createElementNS(namespaceURI,qualifiedName) on the XMLNS Document with namespaceURI being the literal string "http://www.ecommerce.org/", and qualifiedName as "prefix::local". Method should raise NAMESPACE_ERR DOMException. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-258A00AF')/constant[@name='NAMESPACE_ERR']) * @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-DocCrElNS * @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-DocCrElNS')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NAMESPACE_ERR']) */ specify('createElementNS01', () => { var success; var namespaceURI = "http://www.ecommerce.org/"; var malformedName = "prefix::local"; var newElement; var doc = require('./core/files/staffNS.xml').staffNS(); { success = false; try { newElement = doc.createElementNS(namespaceURI,malformedName); } catch(ex) { success = (typeof(ex.code) != 'undefined' && ex.code == 5); } assert.ok(success, 'throw_INVALID_CHARACTER_ERR'); } }); /** * The "createElementNS(namespaceURI,qualifiedName)" method for a Document should raise NAMESPACE_ERR DOMException if qualifiedName has a prefix and namespaceURI is null. Invoke method createElementNS(namespaceURI,qualifiedName) on this document with namespaceURI being null and qualifiedName being "elem:attr1". Method should raise NAMESPACE_ERR DOMException. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-258A00AF')/constant[@name='NAMESPACE_ERR']) * @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-DocCrElNS * @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-DocCrElNS')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NAMESPACE_ERR']) */ specify('createElementNS02', () => { var success; var namespaceURI = null; var qualifiedName = "prefix:local"; var newElement; var doc = require('./core/files/staffNS.xml').staffNS(); { success = false; try { newElement = doc.createElementNS(namespaceURI,qualifiedName); } catch(ex) { success = (typeof(ex.code) != 'undefined' && ex.code == 14); } assert.ok(success, 'throw_NAMESPACE_ERR'); } }); /** * The "createElementNS(namespaceURI,qualifiedName)" method for a Document should raise INVALID_CHARACTER_ERR DOMException if qualifiedName contains an illegal character. Invoke method createElementNS(namespaceURI,qualifiedName) on this document with qualifiedName containing an illegal character from illegalChars[]. Method should raise INVALID_CHARACTER_ERR DOMException for all characters in illegalChars[]. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-DocCrElNS * @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-DocCrElNS')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INVALID_CHARACTER_ERR']) */ specify('createElementNS03', () => { var success; var namespaceURI = "http://www.wedding.com/"; var qualifiedName; var done; var newElement; var charact; illegalQNames = new Array(); illegalQNames[0] = "person:{"; illegalQNames[1] = "person:}"; illegalQNames[2] = "person:~"; illegalQNames[3] = "person:'"; illegalQNames[4] = "person:!"; illegalQNames[5] = "person:@"; illegalQNames[6] = "person:#"; illegalQNames[7] = "person:$"; illegalQNames[8] = "person:%"; illegalQNames[9] = "person:^"; illegalQNames[10] = "person:&"; illegalQNames[11] = "person:*"; illegalQNames[12] = "person:("; illegalQNames[13] = "person:)"; illegalQNames[14] = "person:+"; illegalQNames[15] = "person:="; illegalQNames[16] = "person:["; illegalQNames[17] = "person:]"; illegalQNames[18] = "person:\\"; illegalQNames[19] = "person:/"; illegalQNames[20] = "person:;"; illegalQNames[21] = "person:`"; illegalQNames[22] = "person:<"; illegalQNames[23] = "person:>"; illegalQNames[24] = "person:,"; illegalQNames[25] = "person:a "; illegalQNames[26] = "person:\""; var doc = require('./core/files/staffNS.xml').staffNS(); for(var indexN10098 = 0;indexN10098 < illegalQNames.length; indexN10098++) { qualifiedName = illegalQNames[indexN10098]; { success = false; try { newElement = doc.createElementNS(namespaceURI,qualifiedName); } catch(ex) { success = (typeof(ex.code) != 'undefined' && ex.code == 5); } assert.ok(success, 'throw_INVALID_CHARACTER_ERR'); } } }); /** * The "createElementNS(namespaceURI,qualifiedName") method for a Document should raise NAMESPACE_ERR DOMException if the qualifiedName has an "xml" prefix and the namespaceURI is different from http://www.w3.org/XML/1998/namespace". Invoke method createElementNS(namespaceURI,qualifiedName) on this document with qualifiedName being "xml:element1" and namespaceURI equals the string "http://www.w3.org/XML/1997/namespace" (which differs from the required string "http://www.w3.org/XML/1998/namespace"). Method should raise NAMESPACE_ERR DOMException. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-258A00AF')/constant[@name='NAMESPACE_ERR']) * @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-DocCrElNS * @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-DocCrElNS')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NAMESPACE_ERR']) */ specify('createElementNS04', () => { var success; var namespaceURI = "http://www.w3.org/XML/1998/namespaces"; var qualifiedName = "xml:element1"; var newElement; var doc = require('./core/files/staffNS.xml').staffNS(); { success = false; try { newElement = doc.createElementNS(namespaceURI,qualifiedName); } catch(ex) { success = (typeof(ex.code) != 'undefined' && ex.code == 14); } assert.ok(success, 'throw_NAMESPACE_ERR'); } }); /** * The "createElementNS(namespaceURI,qualifiedName)" method for a Document should return a new Element object given that all parameters are valid and correctly formed. Invoke method createElementNS(namespaceURI,qualifiedName on this document with namespaceURI as "http://www.nist.gov" and qualifiedName as "gov:faculty". Method should return a new Element object whose name is "gov:faculty". * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-104682815 */ specify('createElementNS05', () => { var success; var namespaceURI = "http://www.nist.gov"; var qualifiedName = "gov:faculty"; var newElement; var elementName; var doc = require('./core/files/staffNS.xml').staffNS(); newElement = doc.createElementNS(namespaceURI,qualifiedName); elementName = newElement.tagName; assert.equal(elementName, qualifiedName, "throw_Equals"); }); /** * Document.createElementNS with an empty qualified name should cause an INVALID_CHARACTER_ERR. * @author Curt Arnold * @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-DocCrElNS * @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-DocCrElNS')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INVALID_CHARACTER_ERR']) * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=525 */ specify('createElementNS06', () => { var success; var namespaceURI = "http://www.example.com/"; var qualifiedName; var done; var newElement; var charact; var doc = require('../level1/core/files/hc_staff.xml').hc_staff(); { success = false; try { newElement = doc.createElementNS(namespaceURI,""); } catch(ex) { success = (typeof(ex.code) != 'undefined' && ex.code == 5); } assert.ok(success, 'throw_INVALID_CHARACTER_ERR'); } }); }); describe('documentcreateattributeNS', () => { /** * The method createAttributeNS creates an attribute of the given qualified name and namespace URI Invoke the createAttributeNS method on this Document object with a null namespaceURI, and a qualifiedName without a prefix. This should return a valid Attr node object. * @author IBM * @author Neil Delima * @see http://www.w3.org/TR/DOM-Level-2-Core/core * @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-DocCrAttrNS */ specify('documentcreateattributeNS01', () => { var success; var attribute; var namespaceURI = null; var qualifiedName = "test"; var name; var nodeName; var nodeValue; var doc = require('./core/files/staffNS.xml').staffNS(); attribute = doc.createAttributeNS(namespaceURI,qualifiedName); nodeName = attribute.name; nodeValue = attribute.nodeValue; assert.equal(nodeName, "test", "documentcreateattributeNS01"); }); /** * The method createAttributeNS creates an attribute of the given qualified name and namespace URI Invoke the createAttributeNS method on this Document object with a valid values for namespaceURI, and a qualifiedName as below. This should return a valid Attr node. * @author IBM * @author Neil Delima * @see http://www.w3.org/TR/DOM-Level-2-Core/core * @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-DocCrAttrNS */ specify('documentcreateattributeNS02', () => { var success; var attribute1; var attribute2; var name; var nodeName; var nodeValue; var prefix; var namespaceURI; var doc = require('./core/files/staffNS.xml').staffNS(); attribute1 = doc.createAttributeNS("http://www.w3.org/XML/1998/namespace","xml:xml"); name = attribute1.name; nodeValue = attribute1.nodeValue; prefix = attribute1.prefix; namespaceURI = attribute1.namespaceURI; assert.equal(name, "xml:xml", "documentcreateattributeNS02_att1_name"); assert.equal(nodeValue, "", "documentcreateattributeNS02_att1_nodeValue"); assert.equal(prefix, "xml", "documentcreateattributeNS02_att1_prefix"); assert.equal(namespaceURI, "http://www.w3.org/XML/1998/namespace", "documentcreateattributeNS02_att1_namespaceURI"); attribute2 = doc.createAttributeNS("http://www.w3.org/2000/xmlns/","xmlns"); name = attribute2.name; nodeValue = attribute2.nodeValue; prefix = attribute2.prefix; namespaceURI = attribute2.namespaceURI; assert.equal(name, "xmlns", "documentcreateattributeNS02_att2_name"); assert.equal(nodeValue, "", "documentcreateattributeNS02_att2_nodeValue"); assert.equal(namespaceURI, "http://www.w3.org/2000/xmlns/", "documentcreateattributeNS02_att2_namespaceURI"); }); /** * The method createAttributeNS raises an INVALID_CHARACTER_ERR if the specified qualified name contains an illegal character Invoke the createAttributeNS method on this Document object with a valid value for namespaceURI, and qualifiedNames that contain illegal characters. Check if the an INVALID_CHARACTER_ERR was thrown. * @author IBM * @author Neil Delima * @see http://www.w3.org/TR/DOM-Level-2-Core/core * @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-DocCrAttrNS */ specify('documentcreateattributeNS03', () => { var success; var attribute; var namespaceURI = "http://www.w3.org/DOM/Test/Level2"; var qualifiedName; qualifiedNames = new Array(); qualifiedNames[0] = "/"; qualifiedNames[1] = "//"; qualifiedNames[2] = "\\"; qualifiedNames[3] = ";"; qualifiedNames[4] = "&"; qualifiedNames[5] = "*"; qualifiedNames[6] = "]]"; qualifiedNames[7] = ">"; qualifiedNames[8] = "<"; var doc = require('./core/files/staffNS.xml').staffNS(); for(var indexN1005A = 0;indexN1005A < qualifiedNames.length; indexN1005A++) { qualifiedName = qualifiedNames[indexN1005A]; { success = false; try { attribute = doc.createAttributeNS(namespaceURI,qualifiedName); } catch(ex) { success = (typeof(ex.code) != 'undefined' && ex.code == 5); } assert.ok(success, 'documentcreateattributeNS03'); } } }); /** * The method createAttributeNS raises a NAMESPACE_ERR if the specified qualified name is malformed. Invoke the createAttributeNS method on this Document object with a valid value for namespaceURI, and malformed qualifiedNames. Check if the a NAMESPACE_ERR was thrown. * @author IBM * @author Neil Delima * @see http://www.w3.org/TR/DOM-Level-2-Core/core * @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-DocCrAttrNS */ specify('documentcreateattributeNS04', () => { var success; var attribute; var namespaceURI = "http://www.w3.org/DOM/Test/Level2"; var qualifiedName; qualifiedNames = new Array(); qualifiedNames[0] = "_:"; qualifiedNames[1] = ":0a"; qualifiedNames[2] = ":"; qualifiedNames[3] = "a:b:c"; qualifiedNames[4] = "_::a"; var doc = require('./core/files/staffNS.xml').staffNS(); for(var indexN1004E = 0;indexN1004E < qualifiedNames.length; indexN1004E++) { qualifiedName = qualifiedNames[indexN1004E]; { success = false; try { attribute = doc.createAttributeNS(namespaceURI,qualifiedName); } catch(ex) { success = (typeof(ex.code) != 'undefined' && ex.code == 5); } assert.ok(success, 'documentcreateattributeNS04'); } } }); /** * The method createAttributeNS raises a NAMESPACE_ERR if the qualifiedName has a prefix and the namespaceURI is null. Invoke the createAttributeNS method on a new Document object with a null value for namespaceURI, and a valid qualifiedName. Check if a NAMESPACE_ERR is thrown. * @author IBM * @author Neil Delima * @see http://www.w3.org/TR/DOM-Level-2-Core/core * @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-DocCrAttrNS */ specify('documentcreateattributeNS05', () => { var success; var newDoc; var docType = null; var domImpl; var attribute; var namespaceURI = null; var qualifiedName = "abc:def"; var doc = require('./core/files/staffNS.xml').staffNS(); domImpl = doc.implementation; newDoc = domImpl.createDocument("http://www.w3.org/DOM/Test","dom:doc",docType); { success = false; try { attribute = newDoc.createAttributeNS(namespaceURI,qualifiedName); } catch(ex) { success = (typeof(ex.code) != 'undefined' && ex.code == 14); } assert.ok(success, 'documentcreateattributeNS05'); } }); /** * The method createAttributeNS raises a NAMESPACE_ERR if the qualifiedName has a prefix that is "xml" and the namespaceURI is different from "http://www.w3.org/XML/1998/namespace". Invoke the createAttributeNS method on a new DOMImplementation object with the qualifiedName as xml:root and namespaceURI as http://www.w3.org/XML/1998 /namespace. Check if the NAMESPACE_ERR exception is thrown. * @author IBM * @author Neil Delima * @see http://www.w3.org/TR/DOM-Level-2-Core/core * @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-DocCrAttrNS */ specify('documentcreateattributeNS06', () => { var success; var newDoc; var docType = null; var domImpl; var attribute; var namespaceURI = "http://www.w3.org/XML/1998 /namespace"; var qualifiedName = "xml:root"; var doc = require('./core/files/staffNS.xml').staffNS(); domImpl = doc.implementation; newDoc = domImpl.createDocument("http://www.w3.org/DOM/Test","dom:doc",docType); { success = false; try { attribute = newDoc.createAttributeNS(namespaceURI,qualifiedName); } catch(ex) { success = (typeof(ex.code) != 'undefined' && ex.code == 14); } assert.ok(success, 'documentcreateattributeNS06'); } }); /** * The method createAttributeNS raises a NAMESPACE_ERR if the qualifiedName is xmlns and the namespaceURI is different from http://www.w3.org/2000/xmlns Invoke the createAttributeNS method on this DOMImplementation object with the qualifiedName as xmlns and namespaceURI as http://www.W3.org/2000/xmlns. Check if the NAMESPACE_ERR exception is thrown. * @author IBM * @author Neil Delima * @see http://www.w3.org/TR/DOM-Level-2-Core/core * @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-DocCrAttrNS */ specify('documentcreateattributeNS07', () => { var success; var attribute; var namespaceURI = "http://www.W3.org/2000/xmlns"; var qualifiedName = "xmlns"; var doc = require('./core/files/staffNS.xml').staffNS(); { success = false; try { attribute = doc.createAttributeNS(namespaceURI,qualifiedName); } catch(ex) { success = (typeof(ex.code) != 'undefined' && ex.code == 14); } assert.ok(success, 'documentcreateattributeNS07'); } }); }); describe('documentcreateelementNS', () => { /** * The method createElementNS creates an element of the given valid qualifiedName and NamespaceURI. Invoke the createElementNS method on this Document object with a valid namespaceURI and qualifiedName. Check if a valid Element object is returned with the same node attributes. * @author IBM * @author Neil Delima * @see http://www.w3.org/TR/DOM-Level-2-Core/core * @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-DocCrElNS */ specify('documentcreateelementNS01', () => { var success; var element; var namespaceURI = "http://www.w3.org/DOM/Test/level2"; var qualifiedName = "XML:XML"; var nodeName; var nsURI; var localName; var prefix; var tagName; var doc = require('./core/files/staffNS.xml').staffNS(); element = doc.createElementNS(namespaceURI,qualifiedName); nodeName = element.nodeName; nsURI = element.namespaceURI; localName = element.localName; prefix = element.prefix; tagName = element.tagName; assert.equal(nodeName, "XML:XML", "documentcreateelementNS01_nodeName"); assert.equal(nsURI, "http://www.w3.org/DOM/Test/level2", "documentcreateelementNS01_namespaceURI"); assert.equal(localName, "XML", "documentcreateelementNS01_localName"); assert.equal(prefix, "XML", "documentcreateelementNS01_prefix"); assert.equal(tagName, "XML:XML", "documentcreateelementNS01_tagName"); }); /** * The method createElementNS creates an element of the given valid qualifiedName and NamespaceURI. Invoke the createElementNS method on this Document object with null values for namespaceURI, and a qualifiedName with an invalid character and check if an INVALID_CHARACTER_ERR is thrown. * @author IBM * @author Neil Delima * @see http://www.w3.org/TR/DOM-Level-2-Core/core * @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-DocCrElNS */ specify('documentcreateelementNS02', () => { var success; var element; var namespaceURI = null; var qualifiedName = "^^"; var doc = require('./core/files/staffNS.xml').staffNS(); { success = false; try { element = doc.createElementNS(namespaceURI,qualifiedName); } catch(ex) { success = (typeof(ex.code) != 'undefined' && ex.code == 5); } assert.ok(success, 'documentcreateelementNS02'); } }); /** * The method createElementNS raises a NAMESPACE_ERR if the qualifiedName has a prefix and the namespaceURI is null. Invoke the createElementNS method on a new Document object with a null value for namespaceURI, and a valid qualifiedName. Check if a NAMESPACE_ERR is thrown. * @author IBM * @author Neil Delima * @see http://www.w3.org/TR/DOM-Level-2-Core/core * @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-DocCrElNS */ specify('documentcreateelementNS05', () => { var success; var element; var namespaceURI = null; var qualifiedName = "null:xml"; var doc = require('./core/files/staffNS.xml').staffNS(); { success = false; try { element = doc.createElementNS(namespaceURI,qualifiedName); } catch(ex) { success = (typeof(ex.code) != 'undefined' && ex.code == 14); } assert.ok(success, 'documentcreateelementNS05'); } }); /** * The method createElementNS raises a NAMESPACE_ERR if the qualifiedName has a prefix that is "xml" and the namespaceURI is different from http://www.w3.org/XML/1998/namespace Invoke the createElementNS method on this DOMImplementation object with the qualifiedName as xml:root and namespaceURI as http://www.w3.org/xml/1998/namespace Check if the NAMESPACE_ERR exception is thrown. * @author IBM * @author Neil Delima * @see http://www.w3.org/TR/DOM-Level-2-Core/core * @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-DocCrElNS */ specify('documentcreateelementNS06', () => { var success; var newDoc; var docType = null; var domImpl; var element; var namespaceURI = "http://www.w3.org/xml/1998/namespace "; var qualifiedName = "xml:root"; var doc = require('./core/files/staffNS.xml').staffNS(); domImpl = doc.implementation; newDoc = domImpl.createDocument("http://www.w3.org/DOM/Test","dom:doc",docType); { success = false; try { element = newDoc.createElementNS(namespaceURI,qualifiedName); } catch(ex) { success = (typeof(ex.code) != 'undefined' && ex.code == 14); } assert.ok(success, 'documentcreateelementNS06'); } }); }); describe('documentgetelementby', () => { /** * The method getElementById returns the element whose ID is given by elementId. If not such element exists, returns null. Invoke the getElementById method on this Document object with an invalid elementId. This should return a null element. * @author IBM * @author Neil Delima * @see http://www.w3.org/TR/DOM-Level-2-Core/core * @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-getElBId */ specify('documentgetelementbyid01', () => { var success; var element; var elementId = "---"; var doc = require('./core/files/staffNS.xml').staffNS(); element = doc.getElementById(elementId); assert.equal(element, null, 'element should not be null'); }); /** * The method getElementsByTagNameNS returns a NodeList of all the Elements with a given local name and namespace URI in the order in which they are encountered in a preorder traversal of the Document tree. Invoke the getElementsByTagNameNS method on a new Document object with the values of namespaceURI=* and localName=*. This should return a nodeList of 1 item. * @author IBM * @author Neil Delima * @see http://www.w3.org/TR/DOM-Level-2-Core/core * @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-getElBTNNS * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=259 */ specify('documentgetelementsbytagnameNS01', () => { var success; var newDoc; var docType = null; var domImpl; var childList; var nullNS = null; var doc = require('./core/files/staffNS.xml').staffNS(); domImpl = doc.implementation; newDoc = domImpl.createDocument(nullNS,"root",docType); childList = newDoc.getElementsByTagNameNS("*","*"); assert.equal(childList.length, 1, "documentgetelementsbytagnameNS01"); }); /** * The method getElementsByTagNameNS returns a NodeList of all the Elements with a given local name and namespace URI in the order in which they are encountered in a preorder traversal of the Document tree. Create a new element having a local name="employeeId" belonging to the namespace "test" and append it to this document. Invoke the getElementsByTagNameNS method on a this Document object with the values of namespaceURI=* and localName="elementId". This should return a nodeList of 6 item. Check the length of the nodeList returned. * @author IBM * @author Neil Delima * @see http://www.w3.org/TR/DOM-Level-2-Core/core * @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-getElBTNNS */ specify('documentgetelementsbytagnameNS02', () => { var success; var docElem; var element; var childList; var appendedChild; var doc = require('./core/files/staffNS.xml').staffNS(); docElem = doc.documentElement; element = doc.createElementNS("test","employeeId"); appendedChild = docElem.appendChild(element); childList = doc.getElementsByTagNameNS("*","employeeId"); assert.equal(childList.length, 6, "documentgetelementsbytagnameNS02"); }); /** * The method getElementsByTagNameNS returns a NodeList of all the Elements with a given local name and namespace URI in the order in which they are encountered in a preorder traversal of the Document tree. Invoke the getElementsByTagNameNS method on a new Document object with the values of namespaceURI=** and localName=**. This should return a nodeList of 0 items. * @author IBM * @author Neil Delima * @see http://www.w3.org/TR/DOM-Level-2-Core/core * @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-getElBTNNS */ specify('documentgetelementsbytagnameNS03', () => { var success; var childList; var doc = require('./core/files/staffNS.xml').staffNS(); childList = doc.getElementsByTagNameNS("**","*"); assert.equal(childList.length, 0, "documentgetelementsbytagnameNS03"); }); /** * The method getElementsByTagNameNS returns a NodeList of all the Elements with a given local name and namespace URI in the order in which they are encountered in a preorder traversal of the Document tree. Invoke the getElementsByTagNameNS method on a new Document object with the values of namespaceURI="null" and localName="0". This should return a nodeList of 0 items. * @author IBM * @author Neil Delima * @see http://www.w3.org/TR/DOM-Level-2-Core/core * @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-getElBTNNS * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=259 */ specify('documentgetelementsbytagnameNS04', () => { var success; var childList; var nullNS = null; var doc = require('./core/files/staffNS.xml').staffNS(); childList = doc.getElementsByTagNameNS(nullNS,"0"); assert.equal(childList.length, 0, "documentgetelementsbytagnameNS04"); }); /** * The method getElementsByTagNameNS returns a NodeList of all the Elements with a given local name and namespace URI in the order in which they are encountered in a preorder traversal of the Document tree. Invoke the getElementsByTagNameNS method on a this Document object with the values of namespaceURI=null and localName="elementId". This should return a nodeList of 0 item. Check the length of the nodeList returned. * @author IBM * @author Neil Delima * @see http://www.w3.org/TR/DOM-Level-2-Core/core * @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-getElBTNNS */ specify('documentgetelementsbytagnameNS05', () => { var success; var childList; var doc = require('./core/files/staffNS.xml').staffNS(); childList = doc.getElementsByTagNameNS("null","elementId"); assert.equal(childList.length, 0, "documentgetelementsbytagnameNS05"); }); }); describe('documentimportnode', () => { /** * The importNode method imports a node from another document to this document. A NOT_SUPPORTED_ERR is raised if the type of node being imported is not supported Using the method importNode with deep=false, try to import this document object to itself. Since Document nodes cannot be imported, a NOT_SUPPORTED_ERR should be raised. * @author IBM * @author Neil Delima * @see http://www.w3.org/TR/DOM-Level-2-Core/core * @see http://www.w3.org/TR/DOM-Level-2-Core/core#Core-Document-importNode */ specify('documentimportnode06', () => { var success; var docImported; var doc = require('./core/files/staffNS.xml').staffNS(); { success = false; try { docImported = doc.importNode(doc,false); } catch(ex) { success = (typeof(ex.code) != 'undefined' && ex.code == 9); } assert.ok(success, 'throw_NOT_SUPPORTED_ERR'); } }); /** * The importNode method imports a node from another document to this document. The returned node has no parent; (parentNode is null). The source node is not altered or removed from the original document but a new copy of the source node is created. Using the method importNode with deep=false, import a newly created DocumentFragment node with the first address element from this Document appended to it into this document. Since deep=false, an empty DocumentFragment should be returned * @author IBM * @author Neil Delima * @see http://www.w3.org/TR/DOM-Level-2-Core/core * @see http://www.w3.org/TR/DOM-Level-2-Core/core#Core-Document-importNode */ specify('documentimportnode09', () => { var success; var docFragment; var childList; var success; var addressNode; var appendedChild; var importedDocFrag; var doc = require('./core/files/staffNS.xml').staffNS(); docFragment = doc.createDocumentFragment(); childList = doc.getElementsByTagNameNS("*","address"); addressNode = childList.item(0); appendedChild = docFragment.appendChild(addressNode); importedDocFrag = doc.importNode(docFragment,false); success = importedDocFrag.hasChildNodes(); assert.equal(success, false, 'success should be *false*'); }); /** * The importNode method imports a node from another document to this document. The returned node has no parent; (parentNode is null). The source node is not altered or removed from the original document but a new copy of the source node is created. Using the method importNode with deep=false, import a newly created DocumentFragment node with the first address element from this Document appended to it into this document. Since deep=true, a DocumentFragment with its child should be returned * @author IBM * @author Neil Delima * @see http://www.w3.org/TR/DOM-Level-2-Core/core * @see http://www.w3.org/TR/DOM-Level-2-Core/core#Core-Document-importNode */ specify('documentimportnode10', () => { var success; var docFragment; var childList; var success; var addressNode; var appendedChild; var importedDocFrag; var doc = require('./core/files/staffNS.xml').staffNS(); docFragment = doc.createDocumentFragment(); childList = doc.getElementsByTagNameNS("*","address"); addressNode = childList.item(0); appendedChild = docFragment.appendChild(addressNode); importedDocFrag = doc.importNode(docFragment,true); success = importedDocFrag.hasChildNodes(); assert.ok(success, 'documentimportnode10'); }); /** * The importNode method imports a node from another document to this document. The returned node has no parent; (parentNode is null). The source node is not altered or removed from the original document but a new copy of the source node is created. Using the method importNode with deep=false, import this Document's documentElement node. Verify if the node has been imported correctly by its nodeName atttribute and if the original document is not altered by checking if hasChildNodes returns false. * @author IBM * @author Neil Delima * @see http://www.w3.org/TR/DOM-Level-2-Core/core * @see http://www.w3.org/TR/DOM-Level-2-Core/core#Core-Document-importNode */ specify('documentimportnode11', () => { var success; var docElement; var imported; var success; var nodeNameOrig; var nodeNameImported; var doc = require('./core/files/staffNS.xml').staffNS(); docElement = doc.documentElement; imported = doc.importNode(docElement,false); success = imported.hasChildNodes(); assert.equal(success, false, 'success should be *false*'); nodeNameImported = imported.nodeName; nodeNameOrig = docElement.nodeName; assert.equal(nodeNameOrig, nodeNameImported, "documentimportnode11_NodeName"); }); /** * The importNode method imports a node from another document to this document. The returned node has no parent; (parentNode is null). The source node is not altered or removed from the original document but a new copy of the source node is created. Using the method importNode with deep=true, import the first address element node of this Document. Verify if the node has been imported correctly by checking the length of the this elements childNode list before and after the import. * @author IBM * @author Neil Delima * @see http://www.w3.org/TR/DOM-Level-2-Core/core * @see http://www.w3.org/TR/DOM-Level-2-Core/core#Core-Document-importNode */ specify('documentimportnode12', () => { var success; var childList; var imported; var addressElem; var addressElemChildren; var importedChildren; var addressElemLen; var importedLen; var doc = require('./core/files/staffNS.xml').staffNS(); childList = doc.getElementsByTagNameNS("*","address"); addressElem = childList.item(0); imported = doc.importNode(addressElem,true); addressElemChildren = addressElem.childNodes; importedChildren = imported.childNodes; addressElemLen = addressElemChildren.length; importedLen = importedChildren.length; assert.equal(addressElemLen, importedLen, "documentimportnode12"); }); /** * The importNode method imports a node from another document to this document. The returned node has no parent; (parentNode is null). The source node is not altered or removed from the original document but a new copy of the source node is created. Using the method importNode with deep=false, import the first employee element node of this Document. Verify if the node has been imported correctly by checking the length of the this elements childNode list before and after the import. * @author IBM * @author Neil Delima * @see http://www.w3.org/TR/DOM-Level-2-Core/core * @see http://www.w3.org/TR/DOM-Level-2-Core/core#Core-Document-importNode */ specify('documentimportnode13', () => { var success; var childList; var imported; var importedList; var employeeElem; var importedLen; var doc = require('./core/files/staffNS.xml').staffNS(); childList = doc.getElementsByTagNameNS("*","employee"); employeeElem = childList.item(0); imported = doc.importNode(employeeElem,false); importedList = imported.childNodes; importedLen = importedList.length; assert.equal(importedLen, 0, "documentimportnode13"); }); /** * The importNode method imports a node from another document to this document. The returned node has no parent; (parentNode is null). The source node is not altered or removed from the original document but a new copy of the source node is created. Using the method importNode with deep=true, import a newly created Text node for this Document. Verify if the node has been imported correctly by checking the value of the imported text node. * @author IBM * @author Neil Delima * @see http://www.w3.org/TR/DOM-Level-2-Core/core * @see http://www.w3.org/TR/DOM-Level-2-Core/core#Core-Document-importNode */ specify('documentimportnode15', () => { var success; var textImport; var textToImport; var nodeValue; var doc = require('./core/files/staffNS.xml').staffNS(); var docImp = require('./core/files/staffNS.xml').staffNS(); textToImport = doc.createTextNode("Document.importNode test for a TEXT_NODE"); textImport = doc.importNode(textToImport,true); nodeValue = textImport.nodeValue; assert.equal(nodeValue, "Document.importNode test for a TEXT_NODE", "documentimportnode15"); }); /** * The importNode method imports a node from another document to this document. The returned node has no parent; (parentNode is null). The source node is not altered or removed from the original document but a new copy of the source node is created. Using the method importNode with deep=true, import a newly created Comment node for this Document. Verify if the node has been imported correctly by checking the value of the imported Comment node. * @author IBM * @author Neil Delima * @see http://www.w3.org/TR/DOM-Level-2-Core/core * @see http://www.w3.org/TR/DOM-Level-2-Core/core#Core-Document-importNode */ specify('documentimportnode17', () => { var success; var commentImport; var commentToImport; var nodeValue; var doc = require('./core/files/staffNS.xml').staffNS(); var docImp = require('./core/files/staffNS.xml').staffNS(); commentToImport = doc.createComment("Document.importNode test for a COMMENT_NODE"); commentImport = doc.importNode(commentToImport,true); nodeValue = commentImport.nodeValue; assert.equal(nodeValue, "Document.importNode test for a COMMENT_NODE", "documentimportnode17"); }); /** * The importNode method imports a node from another document to this document. The returned node has no parent; (parentNode is null). The source node is not altered or removed from the original document but a new copy of the source node is created. Using the method importNode with deep=true, import a newly created PI node for this Document. Verify if the node has been imported correctly by checking the PITarget and PIData values of the imported PI node. * @author IBM * @author Neil Delima * @see http://www.w3.org/TR/DOM-Level-2-Core/core * @see http://www.w3.org/TR/DOM-Level-2-Core/core#Core-Document-importNode */ specify('documentimportnode18', () => { var success; var piImport; var piToImport; var piData; var piTarget; var doc = require('./core/files/staffNS.xml').staffNS(); var docImp = require('./core/files/staffNS.xml').staffNS(); piToImport = doc.createProcessingInstruction("Target","Data"); piImport = doc.importNode(piToImport,false); piTarget = piImport.target; piData = piImport.data; assert.equal(piTarget, "Target", "documentimportnode18_Target"); assert.equal(piData, "Data", "documentimportnode18_Data"); }); }); describe('documenttypepublicid', () => { /** * The method getInternalSubset() returns the public identifier of the external subset. Create a new DocumentType node with the value "PUB" for its publicId. Check the value of the publicId attribute using getPublicId(). * @author IBM * @author Neil Delima * @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-Core-DocType-publicId * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=259 */ specify('documenttypepublicid01', () => { var success; var docType; var domImpl; var publicId; var nullNS = null; var doc = require('./core/files/staffNS.xml').staffNS(); domImpl = doc.implementation; docType = domImpl.createDocumentType("l2:root","PUB",nullNS); publicId = docType.publicId; assert.equal(publicId, "PUB", "documenttypepublicid01"); }); }); describe('documenttypesystemid', () => { /** * The method getInternalSubset() returns the public identifier of the external subset. Create a new DocumentType node with the value "SYS" for its systemId and PUB for its publicId. Check the value of the systemId and pbulicId attributes. * @author IBM * @author Neil Delima * @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-Core-DocType-systemId */ specify('documenttypesystemid01', () => { var success; var docType; var domImpl; var publicId; var systemId; var doc = require('./core/files/staffNS.xml').staffNS(); domImpl = doc.implementation; docType = domImpl.createDocumentType("l2:root","PUB","SYS"); publicId = docType.publicId; systemId = docType.systemId; assert.equal(publicId, "PUB", "documenttypepublicid01"); assert.equal(systemId, "SYS", "documenttypesystemid01"); }); }); describe('domimplementationcreatedocument', () => { /** * The createDocument method with valid arguments, should create a DOM Document of the specified type. Call the createDocument on this DOMImplementation with createDocument ("http://www.w3.org/DOMTest/L2",see the array below for valid QNames,null). Check if the returned Document object is is empty with no Document Element. * @author IBM * @author Neil Delima * @see http://www.w3.org/TR/DOM-Level-2-Core/core#Level-2-Core-DOM-createDocument */ specify('domimplementationcreatedocument03', () => { var success; var domImpl; var newDoc; var docType = null; var namespaceURI = "http://www.w3.org/DOMTest/L2"; var qualifiedName; qualifiedNames = new Array(); qualifiedNames[0] = "_:_"; qualifiedNames[1] = "_:h0"; qualifiedNames[2] = "_:test"; qualifiedNames[3] = "l_:_"; qualifiedNames[4] = "ns:_0"; qualifiedNames[5] = "ns:a0"; qualifiedNames[6] = "ns0:test"; qualifiedNames[7] = "a.b:c"; qualifiedNames[8] = "a-b:c"; qualifiedNames[9] = "a-b:c"; var doc = require('./core/files/staffNS.xml').staffNS(); domImpl = doc.implementation; for(var indexN1006B = 0;indexN1006B < qualifiedNames.length; indexN1006B++) { qualifiedName = qualifiedNames[indexN1006B]; newDoc = domImpl.createDocument(namespaceURI,qualifiedName,docType); assert.notEqual(newDoc, null, 'newDoc should be null'); } }); /** * The createDocument method should throw a NAMESPACE_ERR if the qualifiedName has a prefix and the namespaceURI is null. Call the createDocument on this DOMImplementation with null namespaceURI and a qualifiedName that has a namespace prefix using this DOMImplementation. Check if the NAMESPACE_ERR is thrown. * @author IBM * @author Neil Delima * @see http://www.w3.org/TR/DOM-Level-2-Core/core#Level-2-Core-DOM-createDocument * @see http://www.w3.org/TR/DOM-Level-2-Core/core#Level-2-Core-DOM-createDocument */ specify('domimplementationcreatedocument04', () => { var success; var domImpl; var newDoc; var namespaceURI = null; var qualifiedName = "dom:root"; var docType = null; var doc = require('./core/files/staffNS.xml').staffNS(); domImpl = doc.implementation; { success = false; try { newDoc = domImpl.createDocument(namespaceURI,qualifiedName,docType); } catch(ex) { success = (typeof(ex.code) != 'undefined' && ex.code == 14); } assert.ok(success, 'domimplementationcreatedocument04'); } }); /** * The createDocument method should throw a NAMESPACE_ERR if the qualifiedName has a prefix that is xml and the namespaceURI is different from http://www..w3.org/XML/1998/namespace. Call the createDocument on this DOMImplementation with namespaceURI that is http://www.w3.org/xml/1998/namespace and a qualifiedName that has the prefix xml Check if the NAMESPACE_ERR is thrown. * @author IBM * @author Neil Delima * @see http://www.w3.org/TR/DOM-Level-2-Core/core#Level-2-Core-DOM-createDocument */ specify('domimplementationcreatedocument05', () => { var success; var domImpl; var newDoc; var namespaceURI = "http://www.w3.org/xml/1998/namespace"; var qualifiedName = "xml:root"; var docType = null; var doc = require('./core/files/staffNS.xml').staffNS(); domImpl = doc.implementation; { success = false; try { newDoc = domImpl.createDocument(namespaceURI,qualifiedName,docType); } catch(ex) { success = (typeof(ex.code) != 'undefined' && ex.code == 14); } assert.ok(success, 'domimplementationcreatedocument05'); } }); /** * The createDocument method should raise a NAMESPACE_ERR if the qualifiedName is malformed Invoke the createDocument method on this DOMImplementation object with null values for namespaceURI and docType and a malformed qualifiedName. The NAMESPACE_ERR should be raised. * @author IBM * @author Neil Delima * @see http://www.w3.org/TR/DOM-Level-2-Core/core#Level-2-Core-DOM-createDocument */ specify('domimplementationcreatedocument07', () => { var success; var domImpl; var newDoc; var namespaceURI = "http://www.w3.org/DOMTest/level2"; var docType = null; var doc = require('./core/files/staffNS.xml').staffNS(); domImpl = doc.implementation; { success = false; try { newDoc = domImpl.createDocument(namespaceURI,":",docType); } catch(ex) { success = (typeof(ex.code) != 'undefined' && ex.code == 5); } assert.ok(success, 'domimplementationcreatedocument07'); } }); /** * The method createDocumentType with valid values for qualifiedName, publicId and systemId should create an empty DocumentType node. Invoke createDocument on this DOMImplementation with a valid qualifiedName and different publicIds and systemIds. * @author IBM * @author Neil Delima * @see http://www.w3.org/TR/DOM-Level-2-Core/core#Level-2-Core-DOM-createDocument */ specify('domimplementationcreatedocumenttype01', () => { var success; var domImpl; var newDocType; var ownerDocument; var qualifiedName = "test:root"; var publicId; var systemId; publicIds = new Array(); publicIds[0] = "1234"; publicIds[1] = "test"; systemIds = new Array(); systemIds[0] = ""; systemIds[1] = "test"; var doc = require('./core/files/staffNS.xml').staffNS(); domImpl = doc.implementation; for(var indexN1005D = 0;indexN1005D < publicIds.length; indexN1005D++) { publicId = publicIds[indexN1005D]; for(var indexN10061 = 0;indexN10061 < systemIds.length; indexN10061++) { systemId = systemIds[indexN10061]; newDocType = domImpl.createDocumentType(qualifiedName,publicId,systemId); assert.notEqual(newDocType, null, 'newDocType should be null'); ownerDocument = newDocType.ownerDocument; assert.equal(ownerDocument, doc, 'ownerDocument should not be null'); } } }); /** * The method createDocumentType with valid values for qualifiedName, publicId and systemId should create an empty DocumentType node. Invoke createDocument on this DOMImplementation with a different valid qualifiedNames and a valid publicId and systemId. Check if the the DocumentType node was created with its ownerDocument attribute set to the document. * @author IBM * @author Neil Delima * @see http://www.w3.org/TR/DOM-Level-2-Core/core#Level-2-Core-DOM-createDocType */ specify('domimplementationcreatedocumenttype02', () => { var success; var domImpl; var newDocType; var ownerDocument; var publicId = "http://www.w3.org/DOM/Test/dom2.dtd"; var systemId = "dom2.dtd"; var qualifiedName; qualifiedNames = new Array(); qualifiedNames[0] = "_:_"; qualifiedNames[1] = "_:h0"; qualifiedNames[2] = "_:test"; qualifiedNames[3] = "_:_."; qualifiedNames[4] = "_:a-"; qualifiedNames[5] = "l_:_"; qualifiedNames[6] = "ns:_0"; qualifiedNames[7] = "ns:a0"; qualifiedNames[8] = "ns0:test"; qualifiedNames[9] = "ns:EEE."; qualifiedNames[10] = "ns:_-"; qualifiedNames[11] = "a.b:c"; qualifiedNames[12] = "a-b:c.j"; qualifiedNames[13] = "a-b:c"; var doc = require('./core/files/staffNS.xml').staffNS(); domImpl = doc.implementation; for(var indexN10077 = 0;indexN10077 < qualifiedNames.length; indexN10077++) { qualifiedName = qualifiedNames[indexN10077]; newDocType = domImpl.createDocumentType(qualifiedName,publicId,systemId); assert.notEqual(newDocType, null, 'newDocType should be null'); ownerDocument = newDocType.ownerDocument; assert.equal(ownerDocument, doc, 'ownerDocument should not be null ' + qualifiedName); } }); /** * The method createDocumentType should raise a INVALID_CHARACTER_ERR if the qualifiedName contains an illegal characters. Invoke createDocument on this DOMImplementation with qualifiedNames having illegal characters. Check if an INVALID_CHARACTER_ERR is raised in each case. * @author IBM * @author Neil Delima * @see http://www.w3.org/TR/DOM-Level-2-Core/core#Level-2-Core-DOM-createDocType */ specify('domimplementationcreatedocumenttype04', () => { var success; var domImpl; var newDocType; var publicId = "http://www.w3.org/DOM/Test/dom2.dtd"; var systemId = "dom2.dtd"; var qualifiedName; qualifiedNames = new Array(); qualifiedNames[0] = "{"; qualifiedNames[1] = "}"; qualifiedNames[2] = "'"; qualifiedNames[3] = "~"; qualifiedNames[4] = "`"; qualifiedNames[5] = "@"; qualifiedNames[6] = "#"; qualifiedNames[7] = "$"; qualifiedNames[8] = "%"; qualifiedNames[9] = "^"; qualifiedNames[10] = "&"; qualifiedNames[11] = "*"; qualifiedNames[12] = "("; qualifiedNames[13] = ")"; var doc = require('./core/files/staffNS.xml').staffNS(); domImpl = doc.implementation; for(var indexN10073 = 0;indexN10073 < qualifiedNames.length; indexN10073++) { qualifiedName = qualifiedNames[indexN10073]; { success = false; try { newDocType = domImpl.createDocumentType(qualifiedName,publicId,systemId); } catch(ex) { success = (typeof(ex.code) != 'undefined' && ex.code == 5); } assert.ok(success, 'domimplementationcreatedocumenttype04'); } } }); }) describe('domimplementationfeaturecore', () => { /** * The "feature" parameter in the "hasFeature(feature,version)" method is the package name of the feature. Legal values are XML and HTML and CORE. (Test for feature core, lower case) Retrieve the entire DOM document and invoke its "document.implementation" method. This should create a DOMImplementation object whose "hasFeature(feature, version)" method is invoked with feature equal to "core". The method should return a boolean "true". * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-5CED94D7 */ specify('domimplementationfeaturecore', () => { var success; var domImpl; var state; var doc = require('../level1/core/files/staff.xml').staff(); domImpl = doc.implementation; state = domImpl.hasFeature("core","2.0"); assert.ok(state, 'domimplementationFeaturecore'); }); }); describe('domimplementationfeaturexmlversion2', () => { /** * The "feature" parameter in the "hasFeature(feature,version)" method is the package name of the feature. Legal values are XML and HTML. (Test for feature "xml" and version "2.0") Retrieve the entire DOM document and invoke its "document.implementation" method. This should create a DOMImplementation object whose "hasFeature(feature, version)" method is invoked with "feature" equal to "xml". The method should return a boolean "true". * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-5CED94D7 */ specify('domimplementationfeaturexmlversion2', () => { var success; var domImpl; var state; var doc = require('../level1/core/files/staff.xml').staff(); domImpl = doc.implementation; state = domImpl.hasFeature("xml","2.0"); assert.ok(state, 'domimplementationFeaturexmlVersion2'); }); }) describe('elementgetattributenodens', () => { /** * The method getAttributeNodeNS retrieves an Attr node by local name and namespace URI. Create a new element node and add 2 new attribute nodes to it that have the same local name but different namespaceURIs and prefixes. Retrieve an attribute using namespace and localname and check its value, name and namespaceURI. * @author IBM * @author Neil Delima * @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElGetAtNodeNS */ specify('elementgetattributenodens01', () => { var success; var element; var attribute1; var attribute2; var newAttribute1; var newAttribute2; var attribute; var attrValue; var attrName; var attNodeName; var attrLocalName; var attrNS; var doc = require('./core/files/staffNS.xml').staffNS(); element = doc.createElementNS("namespaceURI","root"); attribute1 = doc.createAttributeNS("http://www.w3.org/DOM/Level2","l2:att"); newAttribute1 = element.setAttributeNodeNS(attribute1); attribute2 = doc.createAttributeNS("http://www.w3.org/DOM/Level1","att"); newAttribute2 = element.setAttributeNodeNS(attribute2); attribute = element.getAttributeNodeNS("http://www.w3.org/DOM/Level2","att"); attrValue = attribute.nodeValue; attrName = attribute.name; attNodeName = attribute.name; attrLocalName = attribute.localName; attrNS = attribute.namespaceURI; assert.equal(attrValue, "", "elementgetattributenodens01_attrValue"); assert.equal(attrName, "l2:att", "elementgetattributenodens01_attrName"); assert.equal(attNodeName, "l2:att", "elementgetattributenodens01_attrNodeName"); assert.equal(attrLocalName, "att", "elementgetattributenodens01_attrLocalName"); assert.equal(attrNS, "http://www.w3.org/DOM/Level2", "elementgetattributenodens01_attrNs"); }); /** * The method getAttributeNodeNS retrieves an Attr node by local name and namespace URI. Create a new element node and add a new attribute node to it. Using the getAttributeNodeNS, retrieve the newly added attribute node and check its value. * @author IBM * @author Neil Delima * @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElGetAtNodeNS */ specify('elementgetattributenodens02', () => { var success; var element; var attribute; var newAttribute1; var attrValue; var doc = require('./core/files/staffNS.xml').staffNS(); element = doc.createElementNS("namespaceURI","root"); attribute = doc.createAttributeNS("http://www.w3.org/DOM/Level2","l2:att"); newAttribute1 = element.setAttributeNodeNS(attribute); attribute = element.getAttributeNodeNS("http://www.w3.org/DOM/Level2","att"); attrValue = attribute.nodeValue; assert.equal(attrValue, "", "elementgetattributenodens02"); }); }) describe('elementgetelementsbytagnamens', () => { /** * The method getElementsByTagNameNS returns a NodeList of all the Elements with a given local name and namespace URI in the order in which they are encountered in a preorder traversal of the Document tree. Invoke getElementsByTagNameNS on the documentElement with values for namespaceURI '*' and localName '*'. Verify if this returns a nodeList of 0 elements. * @author IBM * @author Neil Delima * @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-getElBTNNS */ specify('elementgetelementsbytagnamens02', () => { var success; var element; var elementList; var doc = require('./core/files/staffNS.xml').staffNS(); element = doc.documentElement; elementList = element.getElementsByTagNameNS("**","*"); assert.equal(elementList.length, 0, "elementgetelementsbytagnamens02"); }); /** * Returns a NodeList of all the Elements with a given local name and namespace URI in the order in which they are encountered in a preorder traversal of the Document tree. Create a new element node ('root') and append three newly created child nodes (all have local name 'child' and defined in different namespaces). Test 1: invoke getElementsByTagNameNS to retrieve one of the children. Test 2: invoke getElementsByTagNameNS with the value of namespace equals to '*', and verify that the node list has length of 3. * @author IBM * @author Neil Delima * @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-getElBTNNS * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=259 */ specify('elementgetelementsbytagnamens04', () => { var success; var element; var child1; var child2; var child3; var appendedChild; var elementList; var nullNS = null; var doc = require('./core/files/staffNS.xml').staffNS(); element = doc.createElementNS("http://www.w3.org/DOM","root"); child1 = doc.createElementNS("http://www.w3.org/DOM/Level1","dom:child"); child2 = doc.createElementNS(nullNS,"child"); child3 = doc.createElementNS("http://www.w3.org/DOM/Level2","dom:child"); appendedChild = element.appendChild(child1); appendedChild = element.appendChild(child2); appendedChild = element.appendChild(child3); elementList = element.getElementsByTagNameNS(nullNS,"child"); assert.equal(elementList.length, 1, "elementgetelementsbytagnamens04_1"); elementList = element.getElementsByTagNameNS("*","child"); assert.equal(elementList.length, 3, "elementgetelementsbytagnamens04_2"); }); /** * Returns a NodeList of all the Elements with a given local name and namespace URI in the order in which they are encountered in a preorder traversal of the Document tree. Invoke getElementsByTagNameNS on the documentElement with the following values: namespaceURI: 'http://www.altavista.com' localName: '*'. Verify if this returns a nodeList of 1 elements. * @author IBM * @author Neil Delima * @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-getElBTNNS */ specify('elementgetelementsbytagnamens05', () => { var success; var element; var elementList; var doc = require('./core/files/staffNS.xml').staffNS(); element = doc.documentElement; elementList = element.getElementsByTagNameNS("http://www.altavista.com","*"); assert.equal(elementList.length, 1, "elementgetelementsbytagnamens05"); }); }) describe('elementhasattribute', () => { /** * The method hasAttribute returns true when an attribute with a given name is specified on this element or has a default value, false otherwise Invoke the hasAttribute method to check if the documentElement has attributres. * @author IBM * @author Neil Delima * @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-NodeHasAttrs */ specify('elementhasattribute01', () => { var success; var element; var state; var doc = require('../level1/core/files/staff.xml').staff(); element = doc.documentElement; state = element.hasAttribute(""); assert.equal(state, false, 'state should be *false*'); }); /** * The method hasAttribute returns true when an attribute with a given name is specified on this element or has a default value, false otherwise. Create an element Node and an attribute Node. Invoke hasAttribute method to verify that there is no attribute. Append the attribute node to the element node. Invoke the hasAttribute method on the element and verify if it returns true. * @author IBM * @author Neil Delima * @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-NodeHasAttrs */ specify('elementhasattribute03', () => { var success; var element; var state; var attribute; var newAttribute; var doc = require('../level1/core/files/staff.xml').staff(); element = doc.createElement("address"); attribute = doc.createAttribute("domestic"); state = element.hasAttribute("domestic"); assert.equal(state, false, 'state should be *false*'); newAttribute = element.setAttributeNode(attribute); state = element.hasAttribute("domestic"); assert.ok(state, 'elementhasattribute03_True'); }); /** * The method hasAttribute returns true when an attribute with a given name is specified on this element or has a default value, false otherwise. Create an element Node and an attribute Node and add the attribute node to the element. Invoke the hasAttribute method on the element and verify if the method returns true. * @author IBM * @author Neil Delima * @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-NodeHasAttrs */ specify('elementhasattribute04', () => { var success; var element; var state; var attribute; var newAttribute; var doc = require('../level1/core/files/staff.xml').staff(); element = doc.createElement("address"); attribute = doc.createAttribute("domestic"); newAttribute = element.setAttributeNode(attribute); state = element.hasAttribute("domestic"); assert.ok(state, 'elementhasattribute04'); }); }) describe('elementhasattributens', () => { /** * The method hasAttributeNS returns true when an attribute with a given local name and namespace URI is specified on this element or has a default value, false otherwise. Retreive the first employee element node. Invoke the hasAttributeNS method to check if it has the xmlns attribute that belongs to the namespace http://www.w3.org/2000/xmlns/. * @author IBM * @author Neil Delima * @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElHasAttrNS */ specify('elementhasattributens01', () => { var success; var element; var state; var elementList; var doc = require('./core/files/staffNS.xml').staffNS(); elementList = doc.getElementsByTagNameNS("*","employee"); element = elementList.item(0); state = element.hasAttributeNS("http://www.w3.org/2000/xmlns/","xmlns"); assert.ok(state, 'elementhasattributens01'); }); /** * The method hasAttributeNS returns true when an attribute with a given local name and namespace URI is specified on this element or has a default value, false otherwise. Create a new element and attribute node that belong to the same namespace. Add the attribute node to the element node. Check if the newly created element node has an attribute by invoking the hasAttributeNS method with appropriate values for the namespaceURI and localName parameters. * @author IBM * @author Neil Delima * @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElHasAttrNS */ specify('elementhasattributens02', () => { var success; var element; var state; var attribute; var newAttribute; var doc = require('../level1/core/files/staff.xml').staff(); element = doc.createElementNS("http://www.w3.org/DOM","address"); attribute = doc.createAttributeNS("http://www.w3.org/DOM","domestic"); newAttribute = element.setAttributeNode(attribute); state = element.hasAttributeNS("http://www.w3.org/DOM","domestic"); assert.ok(state, 'hasDomesticAttr'); }); /** * The method hasAttributeNS returns true when an attribute with a given local name and namespace URI is specified on this element or has a default value, false otherwise. Create a new element and an attribute node that has an empty namespace. Add the attribute node to the element node. Check if the newly created element node has an attribute by invoking the hasAttributeNS method with appropriate values for the namespaceURI and localName parameters. * @author IBM * @author Neil Delima * @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElHasAttrNS * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=259 */ specify('elementhasattributens03', () => { var success; var element; var state; var attribute; var newAttribute; var nullNS = null; var doc = require('../level1/core/files/staff.xml').staff(); element = doc.createElementNS("http://www.w3.org/DOM","address"); assert.notEqual(element, null, 'element should be null'); attribute = doc.createAttributeNS(nullNS,"domestic"); newAttribute = element.setAttributeNode(attribute); state = element.hasAttributeNS(nullNS,"domestic"); assert.ok(state, 'elementhasattributens03'); }); }) describe('elementremoveattributens', () => { /** * The method removeAttributeNS removes an attribute by local name and namespace URI. Create a new element and add a new attribute node to it. Remove the attribute node using the removeAttributeNodeNS method. Check if the attribute was removed by invoking the hasAttributeNS method on the element and check if it returns false. * @author IBM * @author Neil Delima * @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElRemAtNS */ specify('elementremoveattributens01', () => { var success; var element; var state; var attribute; var newAttribute; var doc = require('../level1/core/files/staff.xml').staff(); element = doc.createElementNS("http://www.w3.org/DOM","elem"); attribute = doc.createAttributeNS("http://www.w3.org/DOM/Test/createAttributeNS","attr"); newAttribute = element.setAttributeNodeNS(attribute); assert.equal(element.removeAttributeNS("http://www.w3.org/DOM/Test/createAttributeNS","attr"), undefined, "should be undefined"); state = element.hasAttributeNS("http://www.w3.org/DOM/Test/createAttributeNS","attr"); assert.equal(state, false, 'state should be *false*'); }); }) describe('elementsetattributenodens', () => { /** * Testing Element.setAttributeNodeNS: If an attribute with that local name and that namespace URI is already present in the element, it is replaced by the new one. Create a new element and two new attribute nodes (in the same namespace and same localNames). Add the two new attribute nodes to the element node using the setAttributeNodeNS method. Check that only one attribute is added, check the value of this attribute. * @author IBM * @author Neil Delima * @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElSetAtNodeNS */ specify('elementsetattributenodens01', () => { var success; var element; var attribute1; var attribute2; var attrNode; var attrName; var attrNS; var attrValue; var attributes; var newAttribute; var length; var doc = require('../level1/core/files/staff.xml').staff(); element = doc.createElementNS("http://www.w3.org/DOM/Test/Level2","new:element"); attribute1 = doc.createAttributeNS("http://www.w3.org/DOM/Test/att1","p1:att"); attribute2 = doc.createAttributeNS("http://www.w3.org/DOM/Test/att1","p2:att"); attribute2.value = "value2"; newAttribute = element.setAttributeNodeNS(attribute1); newAttribute = element.setAttributeNodeNS(attribute2); attrNode = element.getAttributeNodeNS("http://www.w3.org/DOM/Test/att1","att"); attrName = attrNode.name; attrNS = attrNode.namespaceURI; assert.equal(attrName, "p2:att", "elementsetattributenodens01_attrName"); assert.equal(attrNS, "http://www.w3.org/DOM/Test/att1", "elementsetattributenodens01_attrNS"); attributes = element.attributes; length = attributes.length; assert.equal(length, 1, "length"); }); /** * The method setAttributeNodeNS adds a new attribute and raises the INUSE_ATTRIBUTE_ERR exception if the newAttr is already an attribute of another Element object. Retreive an attribute node of an existing element node. Attempt to add it to an another element node. Check if the INUSE_ATTRIBUTE_ERR exception is thrown. * @author IBM * @author Neil Delima * @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElSetAtNodeNS */ specify('elementsetattributenodens03', () => { var success; var element1; var element2; var attribute; var newAttribute; var elementList; var nullNS = null; var doc = require('./core/files/staffNS.xml').staffNS(); elementList = doc.getElementsByTagNameNS("http://www.nist.gov","address"); element1 = elementList.item(1); attribute = element1.getAttributeNodeNS(nullNS,"street"); element2 = elementList.item(2); { success = false; try { newAttribute = element2.setAttributeNodeNS(attribute); } catch(ex) { success = (typeof(ex.code) != 'undefined' && ex.code == 10); } assert.ok(success, 'elementsetattributenodens03'); } }); /** * The method setAttributeNodeNS Adds a new attribute and raises an INUSE_ATTRIBUTE_ERR if newAttr is already an attribute of another Element object. Create two new element nodes and a new attribute node. Attempt to add the same attribute node to the same two element nodes. Check if an INUSE_ATTRIBUTE_ERR is thrown. * @author IBM * @author Neil Delima * @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElSetAtNodeNS */ specify('elementsetattributenodens04', () => { var success; var element1; var element2; var attribute; var newAttribute; var doc = require('./core/files/staffNS.xml').staffNS(); element1 = doc.createElementNS("http://www.w3.org/DOM/Test","elem1"); element2 = doc.createElementNS("http://www.w3.org/DOM/Test","elem2"); attribute = doc.createAttributeNS("http://www.w3.org/DOM/Test","attr"); newAttribute = element1.setAttributeNodeNS(attribute); { success = false; try { newAttribute = element2.setAttributeNodeNS(attribute); } catch(ex) { success = (typeof(ex.code) != 'undefined' && ex.code == 10); } assert.ok(success, 'elementsetattributenodens04'); } }); }); describe('elementsetattributens', () => { /** * The method setAttributeNS adds a new attribute. Create a new element and add a new attribute node to it using the setAttributeNS method. Check if the attribute was correctly set by invoking the getAttributeNodeNS method and checking the nodeName and nodeValue of the returned nodes. * @author IBM * @author Neil Delima * @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElSetAttrNS */ specify('elementsetattributens01', () => { var success; var element; var attribute; var attrName; var attrValue; var doc = require('../level1/core/files/staff.xml').staff(); element = doc.createElementNS("http://www.w3.org/DOM","dom:elem"); element.setAttributeNS("http://www.w3.org/DOM/Test/setAttributeNS","attr","value"); attribute = element.getAttributeNodeNS("http://www.w3.org/DOM/Test/setAttributeNS","attr"); attrName = attribute.name; attrValue = attribute.nodeValue; assert.equal(attrName, "attr", "elementsetattributens01_attrName"); assert.equal(attrValue, "value", "elementsetattributens01_attrValue"); }); /** * The method setAttributeNS adds a new attribute. Retrieve an existing element node with attributes and add a new attribute node to it using the setAttributeNS method. Check if the attribute was correctly set by invoking the getAttributeNodeNS method and checking the nodeName and nodeValue of the returned nodes. * @author IBM * @author Neil Delima * @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElSetAttrNS */ specify('elementsetattributens02', () => { var success; var element; var attribute; var elementList; var attrName; var attrValue; var doc = require('../level1/core/files/staff.xml').staff(); elementList = doc.getElementsByTagNameNS("*","address"); element = elementList.item(0); element.setAttributeNS("http://www.w3.org/DOM/Test/setAttributeNS","this:street","Silver Street"); attribute = element.getAttributeNodeNS("http://www.w3.org/DOM/Test/setAttributeNS","street"); attrName = attribute.name; attrValue = attribute.nodeValue; assert.equal(attrName, "this:street", "elementsetattributens02_attrName"); assert.equal(attrValue, "Silver Street", "elementsetattributens02_attrValue"); }); /** * The method setAttributeNS adds a new attribute. Retreive an existing element node with a default attribute node and add two new attribute nodes that have the same local name as the default attribute but different namespaceURI to it using the setAttributeNS method. Check if the attribute was correctly set by invoking the getAttributeNodeNS method and checking the nodeName and nodeValue of the returned nodes. * @author IBM * @author Neil Delima * @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElSetAttrNS */ specify('elementsetattributens03', () => { var success; var element; var attribute; var elementList; var attrName; var attrValue; var doc = require('./core/files/staffNS.xml').staffNS(); elementList = doc.getElementsByTagName("emp:employee"); element = elementList.item(0); assert.notEqual(element, null, 'element should be null'); element.setAttributeNS("http://www.w3.org/DOM/Test/1","defaultAttr","default1"); element.setAttributeNS("http://www.w3.org/DOM/Test/2","defaultAttr","default2"); attribute = element.getAttributeNodeNS("http://www.w3.org/DOM/Test/1","defaultAttr"); attrName = attribute.name; attrValue = attribute.nodeValue; assert.equal(attrName, "defaultAttr", "elementsetattributens03_attrName"); assert.equal(attrValue, "default1", "elementsetattributens03_attrValue"); }); /** * The method setAttributeNS adds a new attribute and raises a INVALID_CHARACTER_ERR if the specified qualified name contains an illegal character. Invoke the setAttributeNS method on this Element object with a valid value for namespaceURI, and qualifiedNames that contain illegal characters. Check if the an INVALID_CHARACTER_ERR was thrown. * @author IBM * @author Neil Delima * @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElSetAttrNS */ specify('elementsetattributens04', () => { var success; var element; var qualifiedName; qualifiedNames = new Array(); qualifiedNames[0] = "/"; qualifiedNames[1] = "//"; qualifiedNames[2] = "\\"; qualifiedNames[3] = ";"; qualifiedNames[4] = "&"; qualifiedNames[5] = "*"; qualifiedNames[6] = "]]"; qualifiedNames[7] = ">"; qualifiedNames[8] = "<"; var doc = require('./core/files/staffNS.xml').staffNS(); element = doc.createElementNS("http://www.w3.org/DOM/Test/L2","dom:elem"); for(var indexN10058 = 0;indexN10058 < qualifiedNames.length; indexN10058++) { qualifiedName = qualifiedNames[indexN10058]; { success = false; try { element.setAttributeNS("http://www.w3.org/DOM/Test/L2",qualifiedName,"test"); } catch(ex) { success = (typeof(ex.code) != 'undefined' && ex.code == 5); } assert.ok(success, 'elementsetattributens04'); } } }); /** * The method setAttributeNS adds a new attribute and raises a NAMESPACE_ERR if the qualifiedName has a prefix and the namespaceURI is null. Invoke the setAttributeNS method on a new Element object with null namespaceURI and a qualifiedName that has a namespace prefix. Check if the NAMESPACE_ERR was thrown. * @author IBM * @author Neil Delima * @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElSetAttrNS * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=259 */ specify('elementsetattributens05', () => { var success; var element; var nullNS = null; var doc = require('./core/files/staffNS.xml').staffNS(); element = doc.createElementNS("http://www.w3.org/DOM/Test/L2","dom:elem"); { success = false; try { element.setAttributeNS(nullNS,"dom:root","test"); } catch(ex) { success = (typeof(ex.code) != 'undefined' && ex.code == 14); } assert.ok(success, 'elementsetattributens05'); } }); /** * The method setAttributeNS adds a new attribute and raises a NAMESPACE_ERR if the qualifiedName, or its prefix, is "xmlns" and the namespaceURI is different from "http://www.w3.org/2000/xmlns/". Invoke the setAttributeNS method on a new Element object with namespaceURI that is http://www.w3.org/DOMTest/level2 and a qualifiedName that has the prefix xmlns and once again with a qualifiedName that is xmlns. Check if the NAMESPACE_ERR was thrown. * @author IBM * @author Neil Delima * @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElSetAttrNS */ specify('elementsetattributens08', () => { var success; var element; var doc = require('./core/files/staffNS.xml').staffNS(); element = doc.createElementNS("http://www.w3.org/DOMTest/level2","dom:elem"); { success = false; try { element.setAttributeNS("http://www.w3.org/DOMTest/level2","xmlns","test"); } catch(ex) { success = (typeof(ex.code) != 'undefined' && ex.code == 14); } assert.ok(success, 'elementsetattributens08_Err1'); } { success = false; try { element.setAttributeNS("http://www.w3.org/DOMTest/level2","xmlns:root","test"); } catch(ex) { success = (typeof(ex.code) != 'undefined' && ex.code == 14); } assert.ok(success, 'elementsetattributens08_Err2'); } }); /** * The method setAttributeNS adds a new attribute in no namespace if the namespace URI is set to "". * @author Louis-Dominique Dubeau * @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElSetAttrNS * @see http://dom.spec.whatwg.org/#dom-element-setattributens */ specify('elementsetattributens09', () => { var element; var doc = require('./core/files/staffNS.xml').staffNS(); element = doc.createElement("elem"); element.setAttributeNS("","x","test"); assert.equal(element.getAttribute("x"), "test", "getAttribute"); assert.equal(element.getAttributeNS("", "x"), "test", "getAttributeNS with ''"); assert.equal(element.getAttributeNS(null, "x"), "test", "getAttributeNS with null"); }); }); describe('elementsetattributensurinull', () => { /** * The "setAttributeNS(namespaceURI,qualifiedName,value)" method raises a NAMESPACE_ERR DOMException if the specified qualifiedName has a prefix and the namespaceURI is null. Attempt to add a new attribute on the first employee node. An exception should be raised since the "qualifiedName" has a prefix and the namespaceURI is null. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElSetAttrNS * @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-ElSetAttrNS')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NAMESPACE_ERR']) */ specify('elementsetattributensurinull', () => { var success; var namespaceURI = null; var qualifiedName = "emp:qualifiedName"; var elementList; var testAddr; var doc = require('../level1/core/files/staff.xml').staff(); elementList = doc.getElementsByTagName("employee"); testAddr = elementList.item(0); { success = false; try { testAddr.setAttributeNS(namespaceURI,qualifiedName,"newValue"); } catch(ex) { success = (typeof(ex.code) != 'undefined' && ex.code == 14); } assert.ok(success, 'throw_NAMESPACE_ERR'); } }); }); describe('getAttributeNS', () => { /** * The "getAttributeNS(namespaceURI,localName)" method retrieves an attribute value by local name and NamespaceURI. Retrieve the first "emp:address" element. The value returned by the "getAttributeNS()" method should be the value "DISTRICT" since the attribute has a default value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElGetAttrNS * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=238 */ specify('getAttributeNS01', () => { var success; var namespaceURI = "http://www.nist.gov"; var localName = "district"; var qualifiedName = "emp:district"; var elementList; var testAddr; var attrValue; var doc = require('./core/files/staffNS.xml').staffNS(); elementList = doc.getElementsByTagName("emp:address"); testAddr = elementList.item(0); attrValue = testAddr.getAttributeNS(namespaceURI,localName); assert.equal(attrValue, "DISTRICT", "attrValue"); }); /** * The "getAttributeNS(namespaceURI,localName)" method retrieves an attribute value by local name and NamespaceURI. Retrieve the first "emp:address" element. Create a new attribute with the "createAttributeNS()" method. Add the new attribute with the "setAttributeNS()" method. The value returned by the "getAttributeNS()" method should be the empty string since the attribute does not have a default value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElGetAttrNS */ specify('getAttributeNS02', () => { var success; var namespaceURI = "http://www.nist.gov"; var localName = "district"; var qualifiedName = "emp:district"; var newAttribute; var elementList; var testAddr; var districtAttr; var attrValue; var doc = require('./core/files/staffNS.xml').staffNS(); newAttribute = doc.createAttributeNS(namespaceURI,qualifiedName); elementList = doc.getElementsByTagName("emp:address"); testAddr = elementList.item(0); assert.notEqual(testAddr, null, 'testAddr should be null'); districtAttr = testAddr.setAttributeNodeNS(newAttribute); elementList = doc.getElementsByTagName("emp:address"); testAddr = elementList.item(0); attrValue = testAddr.getAttributeNS(namespaceURI,localName); assert.equal(attrValue, "", "throw_Equals"); }); /** * The "getAttributeNS(namespaceURI,localName)" method retrieves an attribute value by local name and NamespaceURI. Retrieve the first "emp:address" element. The value returned by the "getAttributeNS()" method for the emp:domestic attribute should be the empty string since the attribute does not have a specified value because it was removed by the "removeAttributeNS()" method. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElGetAttrNS */ specify('getAttributeNS03', () => { var success; var namespaceURI = "http://www.nist.gov"; var localName = "domestic"; var elementList; var testAddr; var attrValue; var doc = require('./core/files/staffNS.xml').staffNS(); elementList = doc.getElementsByTagName("emp:address"); testAddr = elementList.item(0); assert.notEqual(testAddr, null, 'testAddr should be null'); testAddr.removeAttributeNS(namespaceURI, localName); attrValue = testAddr.getAttributeNS(namespaceURI,localName); // XXX SUPERSEDED BY DOM4 // test.equal(attrValue, "", "throw_Equals"); assert.equal(attrValue, null, "throw_Equals"); }); /** * The "getAttributeNS(namespaceURI,localName)" method retrieves an attribute value by local name and NamespaceURI. Retrieve the first "emp:address" element. Create a new attribute with the "createAttributeNS()" method. Add the new attribute and value with the "setAttributeNS()" method. The value returned by the "getAttributeNS()" method should be the string "NewValue" since the attribute had a specified value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElGetAttrNS */ specify('getAttributeNS04', () => { var success; var namespaceURI = "http://www.nist.gov"; var localName = "blank"; var qualifiedName = "emp:blank"; var newAttribute; var elementList; var testAddr; var districtAttr; var attrValue; var doc = require('./core/files/staffNS.xml').staffNS(); newAttribute = doc.createAttributeNS(namespaceURI,qualifiedName); elementList = doc.getElementsByTagName("emp:address"); testAddr = elementList.item(0); assert.notEqual(testAddr, null, 'testAddr should be null'); testAddr.setAttributeNS(namespaceURI,qualifiedName,"NewValue"); attrValue = testAddr.getAttributeNS(namespaceURI,localName); assert.equal(attrValue, "NewValue", "throw_Equals"); }); /** * The "getAttributeNS(namespaceURI,localName)" method retrieves an attribute value by local name and NamespaceURI. Retrieve the first emp:address element node and retrieve the emp:domestic attribute. The method returns an Attr value as a string, the "value" can be examined to ensure the proper attribute value was retrieved. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElGetAttrNS */ specify('getAttributeNS05', () => { var success; var elementList; var testAddr; var attrValue; var doc = require('./core/files/staffNS.xml').staffNS(); elementList = doc.getElementsByTagName("emp:address"); testAddr = elementList.item(0); assert.notEqual(testAddr, null, 'testAddr should be null'); attrValue = testAddr.getAttributeNS("http://www.nist.gov","domestic"); assert.equal(attrValue, "Yes", "attrValue"); }); }); describe('getAttributeNodeNS', () => { /** * The "getAttributeNodeNS(namespaceURI,localName)" method retrieves an attribute node by local name and NamespaceURI. Retrieve the first emp:address element node. The getAttributeNodeNS method returns an Attr node, the "value" can be examined to ensure the proper attribute node was retrieved. This attribute value should be null since there is no such attribute. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElGetAtNodeNS */ specify('getAttributeNodeNS01', () => { var success; var namespaceURI = "http://www.nist.gov"; var localName = "invalidlocalname"; var elementList; var testAddr; var attribute; var doc = require('./core/files/staffNS.xml').staffNS(); elementList = doc.getElementsByTagName("emp:address"); testAddr = elementList.item(0); assert.notEqual(testAddr, null, 'testAddr should be null'); attribute = testAddr.getAttributeNodeNS(namespaceURI,localName); assert.equal(attribute, null, 'attribute should not be null'); }); /** * The "getAttributeNodeNS(namespaceURI,localName)" method retrieves an attribute node by local name and NamespaceURI. Retrieve the first emp:address element node. The getAttributeNodeNS method returns an Attr node, the "value" can be examined to ensure the proper attribute node was retrieved. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-F68D095 */ specify('getAttributeNodeNS02', () => { var success; var elementList; var testAddr; var attribute; var attrName; var doc = require('./core/files/staffNS.xml').staffNS(); elementList = doc.getElementsByTagName("emp:address"); testAddr = elementList.item(0); assert.notEqual(testAddr, null, 'testAddr should be null'); attribute = testAddr.getAttributeNodeNS("http://www.nist.gov","domestic"); attrName = attribute.name; assert.equal(attrName, "emp:domestic", "attrName"); }); }); describe('getElementById', () => { /** * The "getElementById(elementId)" method for a Document should return an element whose ID matches elementId. Invoke method getElementById(elementId) on this document with elementId equals "CANADA". Method should return an element whose tag name is "emp:address". * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-104682815 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=383 */ specify('getElementById01', () => { var success; var element; var tagname; var doc = require('./core/files/staffNS.xml').staffNS(); element = doc.getElementById("CANADA"); tagname = element.tagName; assert.equal(tagname, "emp:address", "throw_Equals"); }); /** * The "getElementById(elementId)" method for a Document should return null if elementId does not identify any elements in this document. Invoke method getElementById(elementId) on this document with elementId equals "Cancun". Method should return null. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-getElBId */ specify('getElementById02', () => { var success; var element; var doc = require('./core/files/staffNS.xml').staffNS(); element = doc.getElementById("Cancun"); assert.equal(element, null, 'element should not be null'); }); }); describe('getElementsByTagNameNS', () => { /** * The "getElementsByTagNameNS(namespaceURI,localName)" method for a Document should return a new NodeList of all Elements that have a namespace when local name is specified as ' '. Invoke method getElementsByTagNameNS(namespaceURI,localName) on this document with namespaceURI and localName as " ". Method should return a new NodeList of 36 elements. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-getElBTNNS */ specify('getElementsByTagNameNS01', () => { var success; var namespaceURI = "*"; var localName = "*"; var newList; var doc = require('./core/files/staffNS.xml').staffNS(); newList = doc.getElementsByTagNameNS(namespaceURI,localName); // adjusted for lack of entity expansion support assert.equal(newList.length, 36, "throw_Size"); }); /** * The "getElementsByTagNameNS(namespaceURI,localName)" method for a Document should return a new NodeList of all Elements with a given localName and namespaceURI in the order they were encountered in a preorder traversal of the document tree. Invoke method getElementsByTagNameNS(namespaceURI,localName) on this document with namespaceURI being " " and localName is "employee". Method should return a new NodeList containing five Elements. Retrieve the FOURTH element whose name should be "emp:employee". * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-getElBTNNS */ specify('getElementsByTagNameNS02', () => { var success; var newList; var newElement; var prefix; var lname; var doc = require('./core/files/staffNS.xml').staffNS(); newList = doc.getElementsByTagNameNS("*","employee"); assert.equal(newList.length, 5, "employeeCount"); newElement = newList.item(3); prefix = newElement.prefix; assert.equal(prefix, "emp", "prefix"); lname = newElement.localName; assert.equal(lname, "employee", "lname"); }); /** * The "getElementsByTagNameNS(namespaceURI,localName)" method returns a NodeList of all descendant Elements with a given local name and namespace URI in the order in which they are encountered in a preorder traversal of this Element tree. Create a NodeList of all the descendant elements using the "http://www.nist.gov" as the namespaceURI and the special value " " as the localName. The method should return a NodeList of elements that have "http://www.nist.gov as a namespace URI. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-getElBTNNS */ specify('getElementsByTagNameNS03', () => { var success; var elementList; var child; var childName; var result = new Array(); expectedResult = new Array(); expectedResult[0] = "employee"; expectedResult[1] = "employeeId"; expectedResult[2] = "name"; expectedResult[3] = "position"; expectedResult[4] = "salary"; expectedResult[5] = "gender"; expectedResult[6] = "address"; expectedResult[7] = "emp:employee"; expectedResult[8] = "emp:employeeId"; expectedResult[9] = "emp:position"; expectedResult[10] = "emp:salary"; expectedResult[11] = "emp:gender"; expectedResult[12] = "emp:address"; expectedResult[13] = "address"; var doc = require('./core/files/staffNS.xml').staffNS(); elementList = doc.getElementsByTagNameNS("http://www.nist.gov","*"); for(var indexN10076 = 0;indexN10076 < elementList.length; indexN10076++) { child = elementList.item(indexN10076); childName = child.nodeName; result[result.length] = childName; } assert.deepEqual(result, expectedResult, 'nodeNames'); }); /** * The "getElementsByTagNameNS(namespaceURI,localName)" method returns a NodeList of all descendant Elements with a given local name and namespace URI in the order in which they are encountered in a preorder traversal of this Element tree. Create a NodeList of all the descendant elements using the special value " " as the namespaceURI and "address" as the localName. The method should return a NodeList of Elements that have "address" as the local name. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-getElBTNNS */ specify('getElementsByTagNameNS04', () => { var success; var elementList; var child; var childName; var result = new Array(); expectedResult = new Array(); expectedResult[0] = "address"; expectedResult[1] = "address"; expectedResult[2] = "address"; expectedResult[3] = "emp:address"; expectedResult[4] = "address"; var doc = require('./core/files/staffNS.xml').staffNS(); elementList = doc.getElementsByTagNameNS("*","address"); for(var indexN10059 = 0;indexN10059 < elementList.length; indexN10059++) { child = elementList.item(indexN10059); childName = child.nodeName; result[result.length] = childName; } assert.deepEqual(result, expectedResult, 'nodeNames'); }); /** * The "getElementsByTagNameNS(namespaceURI,localName)" method returns a NodeList of all descendant Elements with a given local name and namespace URI in the order in which they are encountered in a preorder traversal of this Element tree. Create a NodeList of all the descendant elements using the "http://www.nist.gov" as the namespaceURI and "nomatch" as the localName. The method should return a NodeList whose length is "0". * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-getElBTNNS */ specify('getElementsByTagNameNS05', () => { var success; var namespaceURI = "http://www.nist.gov"; var localName = "nomatch"; var elementList; var doc = require('./core/files/staffNS.xml').staffNS(); elementList = doc.getElementsByTagNameNS(namespaceURI,localName); assert.equal(elementList.length, 0, "throw_Size"); }); /** * The "getElementsByTagNameNS(namespaceURI,localName)" method returns a NodeList of all descendant Elements with a given local name and namespace URI in the order in which they are encountered in a preorder traversal of this Element tree. Create a NodeList of all the descendant elements using the "http://www.nomatch.com" as the namespaceURI and "address" as the localName. The method should return a NodeList whose length is "0". * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-getElBTNNS */ specify('getElementsByTagNameNS06', () => { var success; var elementList; var doc = require('./core/files/staffNS.xml').staffNS(); elementList = doc.getElementsByTagNameNS("http://www.nomatch.com","address"); assert.equal(elementList.length, 0, "matchSize"); }); /** * The "getElementsByTagNameNS(namespaceURI,localName)" method returns a NodeList of all descendant Elements with a given local name and namespace URI in the order in which they are encountered in a preorder traversal of this Element tree. Create a NodeList of all the descendant elements using the string "http://www.nist.gov" as the namespaceURI and "address" as the localName. The method should return a NodeList whose length is "3". * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-getElBTNNS */ specify('getElementsByTagNameNS07', () => { var success; var elementList; var doc = require('./core/files/staffNS.xml').staffNS(); elementList = doc.getElementsByTagNameNS("http://www.nist.gov","address"); assert.equal(elementList.length, 3, "addresses"); }); /** * Element.getElementsByTagNameNS('*','*') should return all child elements. There is some contention on whether this should match unqualified elements, this test reflects the interpretation that '*' should match elements in all namespaces and unqualified elements. Derived from getElementsByTagNameNS01 which tests similar functionality on the Document interface. * @author Curt Arnold * @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-1938918D */ specify('getElementsByTagNameNS08', () => { var success; var docElem; var newList; var doc = require('./core/files/staffNS.xml').staffNS(); docElem = doc.documentElement; newList = docElem.getElementsByTagNameNS("*","*"); // adjusted for lack of entity expansion support assert.equal(newList.length, 35, "listSize"); }); /** * The "getElementsByTagNameNS(namespaceURI,localName)" method for a Element should return a new NodeList of all descendant Elements with a given localName and namespaceURI in the order they were encountered in a preorder traversal of the document tree. Invoke method getElementsByTagNameNS(namespaceURI,localName) on the document element with namespaceURI being "*" and localName is "employee". Method should return a new NodeList containing five Elements. Retrieve the FOURTH element whose name should be "emp:employee". Derived from getElementsByTagNameNS02 and reflects its interpretation that namespace="*" matches namespace unqualified tagnames. * @author Curt Arnold * @author Curt Arnold * @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-1938918D */ specify('getElementsByTagNameNS09', () => { var success; var newList; var newElement; var prefix; var lname; var docElem; var doc = require('./core/files/staffNS.xml').staffNS(); docElem = doc.documentElement; newList = docElem.getElementsByTagNameNS("*","employee"); assert.equal(newList.length, 5, "employeeCount"); newElement = newList.item(3); prefix = newElement.prefix; assert.equal(prefix, "emp", "prefix"); lname = newElement.localName; assert.equal(lname, "employee", "lname"); }); /** * The "getElementsByTagNameNS(namespaceURI,localName)" method returns a NodeList of all descendant Elements with a given local name and namespace URI in the order in which they are encountered in a preorder traversal of this Element tree. Create a NodeList of all the descendant elements of the document element using the "http://www.nist.gov" as the namespaceURI and the special value "*" as the localName. The method should return a NodeList of elements that have "http://www.nist.gov as a namespace URI. Derived from getElementsByTagNameNS03 * @author Curt Arnold * @author Curt Arnold * @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-1938918D */ specify('getElementsByTagNameNS10', () => { var success; var docElem; var elementList; var child; var childName; var result = new Array(); expectedResult = new Array(); expectedResult[0] = "employee"; expectedResult[1] = "employeeId"; expectedResult[2] = "name"; expectedResult[3] = "position"; expectedResult[4] = "salary"; expectedResult[5] = "gender"; expectedResult[6] = "address"; expectedResult[7] = "emp:employee"; expectedResult[8] = "emp:employeeId"; expectedResult[9] = "emp:position"; expectedResult[10] = "emp:salary"; expectedResult[11] = "emp:gender"; expectedResult[12] = "emp:address"; expectedResult[13] = "address"; var doc = require('./core/files/staffNS.xml').staffNS(); docElem = doc.documentElement; elementList = docElem.getElementsByTagNameNS("http://www.nist.gov","*"); for(var indexN1007E = 0;indexN1007E < elementList.length; indexN1007E++) { child = elementList.item(indexN1007E); childName = child.nodeName; result[result.length] = childName; } assert.deepEqual(result, expectedResult, 'nodeNames'); }); /** * The "getElementsByTagNameNS(namespaceURI,localName)" method returns a NodeList of all descendant Elements with a given local name and namespace URI in the order in which they are encountered in a preorder traversal of this Element tree. Create a NodeList of all the descendant elements using the special value "*" as the namespaceURI and "address" as the localName. The method should return a NodeList of Elements that have "address" as the local name. This test is derived from getElementsByTagNameNS04 * @author Curt Arnold * @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-1938918D */ specify('getElementsByTagNameNS11', () => { var success; var docElem; var elementList; var child; var childName; var result = new Array(); expectedResult = new Array(); expectedResult[0] = "address"; expectedResult[1] = "address"; expectedResult[2] = "address"; expectedResult[3] = "emp:address"; expectedResult[4] = "address"; var doc = require('./core/files/staffNS.xml').staffNS(); docElem = doc.documentElement; elementList = docElem.getElementsByTagNameNS("*","address"); for(var indexN1005E = 0;indexN1005E < elementList.length; indexN1005E++) { child = elementList.item(indexN1005E); childName = child.nodeName; result[result.length] = childName; } assert.deepEqual(result, expectedResult, 'nodeNames'); }); /** * The "getElementsByTagNameNS(namespaceURI,localName)" method returns a NodeList of all descendant Elements with a given local name and namespace URI in the order in which they are encountered in a preorder traversal of this Element tree. Create a NodeList of all the descendant elements using the "http://www.nist.gov" as the namespaceURI and "nomatch" as the localName. The method should return a NodeList whose length is "0". This test is a modification of getElementsByTagName05 * @author Curt Arnold * @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-1938918D */ specify('getElementsByTagNameNS12', () => { var success; var docElem; var elementList; var doc = require('./core/files/staffNS.xml').staffNS(); docElem = doc.documentElement; elementList = docElem.getElementsByTagNameNS("http://www.nist.gov","nomatch"); assert.equal(elementList.length, 0, "size"); }); /** * The "getElementsByTagNameNS(namespaceURI,localName)" method returns a NodeList of all descendant Elements with a given local name and namespace URI in the order in which they are encountered in a preorder traversal of this Element tree. Create a NodeList of all the descendant elements using the "http://www.nomatch.com" as the namespaceURI and "address" as the localName. The method should return a NodeList whose length is "0". * @author Curt Arnold * @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-1938918D */ specify('getElementsByTagNameNS13', () => { var success; var docElem; var elementList; var doc = require('./core/files/staffNS.xml').staffNS(); docElem = doc.documentElement; elementList = docElem.getElementsByTagNameNS("http://www.nomatch.com","address"); assert.equal(elementList.length, 0, "matchSize"); }); /** * The "getElementsByTagNameNS(namespaceURI,localName)" method returns a NodeList of all descendant Elements with a given local name and namespace URI in the order in which they are encountered in a preorder traversal of this Element tree. Create a NodeList of all the descendant elements using the string "http://www.nist.gov" as the namespaceURI and "address" as the localName. The method should return a NodeList whose length is "3". * @author Curt Arnold * @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-1938918D */ specify('getElementsByTagNameNS14', () => { var success; var docElem; var elementList; var doc = require('./core/files/staffNS.xml').staffNS(); docElem = doc.documentElement; elementList = docElem.getElementsByTagNameNS("http://www.nist.gov","address"); assert.equal(elementList.length, 3, "addresses"); }); }); describe('getNamedItemNS', () => { /** * The "getNamedItemNS(namespaceURI,localName)" method for a NamedNodeMap should return a node specified by localName and namespaceURI Retrieve a list of elements with tag name "address". Access the second element from the list and get its attributes. Try to retrieve the attribute node with local name "domestic" and namespace uri "http://www.usa.com" with method getNamedItemNS(namespaceURI,localName). * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-F68D095 */ specify('getNamedItemNS01', () => { var success; var elementList; var testEmployee; var attributes; var domesticAttr; var attrName; var doc = require('./core/files/staffNS.xml').staffNS(); elementList = doc.getElementsByTagName("address"); testEmployee = elementList.item(1); attributes = testEmployee.attributes; domesticAttr = attributes.getNamedItemNS("http://www.usa.com","domestic"); attrName = domesticAttr.name; assert.equal(attrName, "dmstc:domestic", "attrName"); }); /** * The "getNamedItemNS(namespaceURI,localName)" method for a NamedNodeMap should return null if parameters do not identify any node in this map. Retrieve a list of elements with tag name "address". Access the second element from the list and get its attributes. Try to retrieve an attribute node with local name "domest" and namespace uri "http://www.usa.com" with method getNamedItemNS(namespaceURI,localName). This should return null because "domest" does not match any local names in this map. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-getNamedItemNS */ specify('getNamedItemNS02', () => { var success; var namespaceURI = "http://www.usa.com"; var localName = "domest"; var elementList; var testEmployee; var attributes; var newAttr; var doc = require('./core/files/staffNS.xml').staffNS(); elementList = doc.getElementsByTagName("address"); testEmployee = elementList.item(1); attributes = testEmployee.attributes; newAttr = attributes.getNamedItemNS(namespaceURI,localName); assert.equal(newAttr, null, 'newAttr should not be null'); }); }); describe('hasAttribute', () => { /** * The "hasAttribute()" method for an Element should return true if the element has an attribute with the given name. Retrieve the first "address" element and the "hasAttribute()" method should return false since the element does not have a default value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElHasAttr */ specify('hasAttribute01', () => { var success; var elementList; var testNode; var state; var doc = require('../level1/core/files/staff.xml').staff(); elementList = doc.getElementsByTagName("address"); testNode = elementList.item(4); state = testNode.hasAttribute("domestic"); assert.equal(state, false, 'state should be *false*'); }); /** * The "hasAttribute()" method for an Element should return false if the element does not have an attribute with the given name. Retrieve the first "address" element and the "hasAttribute()" method should return false since the element does not have "nomatch" as an attribute. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElHasAttr */ specify('hasAttribute03', () => { var success; var elementList; var testNode; var state; var doc = require('../level1/core/files/staff.xml').staff(); elementList = doc.getElementsByTagName("address"); testNode = elementList.item(0); state = testNode.hasAttribute("nomatch"); assert.equal(state, false, 'state should be *false*'); }); /** * The "hasAttribute()" method for an Element should return true if the element has an attribute with the given name. Retrieve the first "address" element and the "hasAttribute()" method should return true since the element has "domestic" as an attribute. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElHasAttr * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=238 */ specify('hasAttribute04', () => { var success; var elementList; var testNode; var state; var doc = require('./core/files/staffNS.xml').staffNS(); elementList = doc.getElementsByTagName("address"); testNode = elementList.item(0); state = testNode.hasAttribute("dmstc:domestic"); assert.ok(state, 'hasDomesticAttr'); }); }); describe('hasAttributeNS', () => { /** * The "hasAttributeNS()" method for an Element should return false if the element does not have an attribute with the given local name and/or a namespace URI specified on this element or does not have a default value. Retrieve the first "address" element and the "hasAttributeNS()" method should return false since the element has "nomatch" as the local name and "http://www.usa.com" as the namespace URI. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElHasAttrNS */ specify('hasAttributeNS01', () => { var success; var localName = "nomatch"; var namespaceURI = "http://www.usa.com"; var elementList; var testNode; var state; var doc = require('./core/files/staffNS.xml').staffNS(); elementList = doc.getElementsByTagName("address"); testNode = elementList.item(0); state = testNode.hasAttributeNS(namespaceURI,localName); assert.equal(state, false, 'state should be *false*'); }); /** * The "hasAttributeNS()" method for an Element should return false if the element does not have an attribute with the given local name and/or namespace URI specified on this element or does not have a default value. Retrieve the first "address" element and the "hasAttributeNS()" method should return false since the element has "domestic" as the local name and "http://www.nomatch.com" as the namespace URI. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElHasAttrNS */ specify('hasAttributeNS02', () => { var success; var localName = "domestic"; var namespaceURI = "http://www.nomatch.com"; var elementList; var testNode; var state; var doc = require('./core/files/staffNS.xml').staffNS(); elementList = doc.getElementsByTagName("address"); testNode = elementList.item(0); state = testNode.hasAttributeNS(namespaceURI,localName); assert.equal(state, false, 'state should be *false*'); }); /** * The "hasAttributeNS()" method for an Element should return false if the element does not have an attribute with the given local name and/or namespace URI specified on this element or does not have a default value. Retrieve the first "emp:address" element. The boolean value returned by the "hasAttributeNS()" should be false since the attribute does not have a default value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElHasAttrNS */ specify('hasAttributeNS03', () => { var success; var localName = "blank"; var namespaceURI = "http://www.nist.gov"; var elementList; var testNode; var state; var doc = require('./core/files/staffNS.xml').staffNS(); elementList = doc.getElementsByTagName("emp:address"); testNode = elementList.item(0); assert.notEqual(testNode, null, 'testNode should be null'); state = testNode.hasAttributeNS(namespaceURI,localName); assert.equal(state, false, 'state should be *false*'); }); /** * The "hasAttributeNS()" method for an Element should return true if the element has an attribute with the given local name and the namespace URI is specified on this element or has a default value. Retrieve the first "address" element and the "hasAttributeNS()" method should return true since the element has "domestic" as the local name and "http://www.usa.com" as the namespace URI. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElHasAttrNS */ specify('hasAttributeNS05', () => { var success; var localName = "domestic"; var namespaceURI = "http://www.usa.com"; var elementList; var testNode; var state; var doc = require('./core/files/staffNS.xml').staffNS(); elementList = doc.getElementsByTagName("address"); testNode = elementList.item(0); state = testNode.hasAttributeNS(namespaceURI,localName); assert.ok(state, 'hasAttribute'); }); /** * The method hasAttributeNS checks in no namespace if the namespace URI is set to "". * @author Louis-Dominique Dubeau * @see http://www.w3.org/TR/DOM-Level-2-Core/core.html#ID-ElHasAttrNS * @see http://dom.spec.whatwg.org/#dom-element-hasattributens */ specify('hasAttributeNS06', () => { var element; var doc = require('./core/files/staffNS.xml').staffNS(); element = doc.createElement("elem"); element.setAttribute("x","test"); assert.ok(element.hasAttributeNS("", "x"), "getAttributeNS with ''"); assert.ok(element.hasAttributeNS(null, "x"), "getAttributeNS with null"); }); }); describe('hasAttributes', () => { /** * The "hasAttributes()" method for a node should return false if the node does not have an attribute. Retrieve the first "name" node and invoke the "hasAttributes()" method. The method should return false since the node does not have an attribute. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-NodeHasAttrs */ specify('hasAttributes01', () => { var success; var addrList; var addrNode; var state; var doc = require('../level1/core/files/staff.xml').staff(); addrList = doc.getElementsByTagName("name"); addrNode = addrList.item(0); state = addrNode.hasAttributes(); assert.equal(state, false, 'state should be *false*'); }); /** * The "hasAttributes()" method for a node should return true if the node has attributes. Retrieve the first address node and the "hasAttributes()" method should return true since the node has "domestic" as an attribute. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-NodeHasAttrs */ specify('hasAttributes02', () => { var success; var addrList; var addrNode; var state; var doc = require('../level1/core/files/staff.xml').staff(); addrList = doc.getElementsByTagName("address"); addrNode = addrList.item(0); state = addrNode.hasAttributes(); assert.ok(state, 'throw_True'); }); }); describe('importNode', () => { /** * The "importNode(importedNode,deep)" method for a Document should import the given importedNode into that Document. The importedNode is of type Comment. Create a comment node with value being the string "this is a comment" in a different document. Invoke method importNode(importedNode,deep) on this document. Method should return a comment node whose value matches the above string. The returned node should belong to this document whose systemId is "staff.dtd" * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/DOM-Level-2-Core/core#Core-Document-importNode */ specify('importNode03', () => { var comment; var aNode; var ownerDocument; var doc = require('./core/files/staffNS.xml').staffNS(); var aNewDoc = require('./core/files/staffNS.xml').staffNS(); comment = aNewDoc.createComment("this is a comment"); aNode = doc.importNode(comment,false); ownerDocument = aNode.ownerDocument; assert.notEqual(ownerDocument, null, 'ownerDocument should be null'); assert.equal(doc.doctype.systemId, 'staffNS.dtd') assert.equal(aNode.nodeValue, "this is a comment", "nodeValue"); }); /** * The "importNode(importedNode,deep)" method for a Document should import the given importedNode into that Document. The importedNode is of type Document_Fragment. Create a DocumentFragment in a different document. Create a Comment child node for the Document Fragment. Invoke method importNode(importedNode,deep) on this document with importedNode being the newly created DocumentFragment. Method should return a node of type DocumentFragment whose child has comment value "descendant1". * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/DOM-Level-2-Core/core#Core-Document-importNode */ specify('importNode04', () => { var success; var docFrag; var comment; var aNode; var children; var child; var childValue; var doc = require('../level1/core/files/staff.xml').staff(); var aNewDoc = require('../level1/core/files/staff.xml').staff(); docFrag = aNewDoc.createDocumentFragment(); comment = aNewDoc.createComment("descendant1"); aNode = docFrag.appendChild(comment); aNode = doc.importNode(docFrag,true); children = aNode.childNodes; assert.equal(children.length, 1, "throw_Size"); child = aNode.firstChild; childValue = child.nodeValue; assert.equal(childValue, "descendant1", "descendant1"); }); /** * The "importNode(importedNode,deep)" method for a Document should import the given importedNode into that Document. The importedNode is of type Element. Retrieve element "emp:address" from staffNS.xml document. Invoke method importNode(importedNode,deep) on this document with importedNode being the element from above and deep is false. Method should return an element node whose name matches "emp:address" and whose children are not imported. The returned node should belong to this document whose systemId is "staff.dtd" * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/DOM-Level-2-Core/core#Core-Document-importNode */ specify('importNode05', () => { var element; var aNode; var hasChild; var ownerDocument; var addresses; var doc = require('./core/files/staffNS.xml').staffNS(); var aNewDoc = require('./core/files/staffNS.xml').staffNS(); addresses = aNewDoc.getElementsByTagName("emp:address"); element = addresses.item(0); assert.notEqual(element, null, 'element should be null'); aNode = doc.importNode(element,false); hasChild = aNode.hasChildNodes(); assert.equal(hasChild, false, 'hasChild should be *false*'); ownerDocument = aNode.ownerDocument; assert.equal(doc.doctype.systemId, 'staffNS.dtd') assert.equal(aNode.nodeName, "emp:address", "nodeName"); }); /** * The "importNode(importedNode,deep)" method for a Document should import the given importedNode into that Document. The importedNode is of type Element. Retrieve element "emp:address" from staffNS.xml document. Invoke method importNode(importedNode,deep) on this document with importedNode being the element from above and deep is true. Method should return an element node whose name matches "emp:address" and whose descendant is imported. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/DOM-Level-2-Core/core#Core-Document-importNode */ specify('importNode06', () => { var success; var element; var aNode; var hasChild; var name; var child; var value; var addresses; var doc = require('./core/files/staffNS.xml').staffNS(); var aNewDoc = require('./core/files/staffNS.xml').staffNS(); addresses = aNewDoc.getElementsByTagName("emp:address"); element = addresses.item(0); assert.notEqual(element, null, 'element should be null'); aNode = doc.importNode(element,true); hasChild = aNode.hasChildNodes(); assert.ok(hasChild, 'throw_True'); name = aNode.nodeName; assert.equal(name, "emp:address", "nodeName"); child = aNode.firstChild; value = child.nodeValue; assert.equal(value, "27 South Road. Dallas, texas 98556", "nodeValue"); }); /** * The "importNode(importedNode,deep)" method for a Document should import the given importedNode into that Document. The importedNode is of type Document_Fragment. Create a DocumentFragment in a different document. Invoke method importNode(importedNode,deep) on this document with importedNode being the newly created DocumentFragment. Method should return an empty DocumentFragment that belongs to this document whose systemId is "staff.dtd" * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/DOM-Level-2-Core/core#Core-Document-importNode * @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-Core-DocType-systemId */ specify('importNode08', () => { var docFrag; var aNode; var hasChild; var ownerDocument; var doc = require('./core/files/staffNS.xml').staffNS(); var aNewDoc = require('./core/files/staffNS.xml').staffNS(); docFrag = aNewDoc.createDocumentFragment(); aNode = doc.importNode(docFrag,false); hasChild = aNode.hasChildNodes(); assert.equal(hasChild, false, 'hasChild should be *false*'); ownerDocument = aNode.ownerDocument; assert.equal(doc.doctype.systemId, 'staffNS.dtd') }); /** * The "importNode(importedNode,deep)" method for a Document should import the given importedNode into that Document. The importedNode is of type Processing Instruction. Create a processing instruction with target as "target1" and data as "data1" in a different document. Invoke method importNode(importedNode,deep) on this document. Method should return a processing instruction whose target and data match the given parameters. The returned PI should belong to this document whose systemId is "staff.dtd". * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/DOM-Level-2-Core/core#Core-Document-importNode */ specify('importNode14', () => { var doc = require('./core/files/staffNS.xml').staffNS(); var aNewDoc = require('./core/files/staffNS.xml').staffNS(); var pi = aNewDoc.createProcessingInstruction("target1","data1"); var aNode = doc.importNode(pi,false); assert.notEqual(aNode.ownerDocument, null, 'ownerDocument should be null'); assert.equal(aNode.ownerDocument.doctype.systemId, 'staffNS.dtd') target = aNode.target; assert.equal(target, "target1", "piTarget"); data = aNode.data; assert.equal(data, "data1", "piData"); }); /** * The "importNode(importedNode,deep)" method for a Document should import the given importedNode into that Document. The importedNode is of type Text. Create a text node with value being the string "this is text data" in a different document. Invoke method importNode(importedNode,deep) on this document. Method should return a text node whose value matches the above string. The returned node should belong to this document whose systemId is "staff.dtd" * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/DOM-Level-2-Core/core#Core-Document-importNode */ specify('importNode15', () => { var doc = require('./core/files/staffNS.xml').staffNS(); var aNewDoc = require('./core/files/staffNS.xml').staffNS(); var text = aNewDoc.createTextNode("this is text data"); var aNode = doc.importNode(text,false); assert.notEqual(aNode.ownerDocument, null, 'ownerDocument should be null'); assert.equal(aNode.ownerDocument.doctype.systemId, 'staffNS.dtd') assert.equal(aNode.nodeValue, "this is text data", "nodeValue"); }); /** * The "importNode(importedNode,deep)" method for a Document should raise NOT_SUPPORTED_ERR DOMException if the type of node being imported is Document. Retrieve staff.xml document. Invoke method importNode(importedNode,deep) where importedNode contains staff.xml and deep is true. Method should raise NOT_SUPPORTED_ERR DOMException. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-258A00AF')/constant[@name='NOT_SUPPORTED_ERR']) * @see http://www.w3.org/TR/DOM-Level-2-Core/core#Core-Document-importNode * @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('Core-Document-importNode')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NOT_SUPPORTED_ERR']) */ specify('importNode17', () => { var success; var node; var doc = require('./core/files/staffNS.xml').staffNS(); var anotherDoc = require('./core/files/staffNS.xml').staffNS(); { success = false; try { node = doc.importNode(anotherDoc,false); } catch(ex) { success = (typeof(ex.code) != 'undefined' && ex.code == 9); } assert.ok(success, 'throw_NOT_SUPPORTED_ERR'); } }); }); describe('localName', () => { /** * The "getLocalName()" method for a Node returns the local part of the qualified name of this node, and for nodes of any type other than ELEMENT_NODE and ATTRIBUTE_NODE and nodes created with a DOM Level 1 method, this is null. Retrieve the first emp:address node and get the attributes of this node." Then apply the getLocalName() method to the emp:domestic attribute. The method should return "domestic". * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-NodeNSLocalN */ specify('localName01', () => { var success; var elementList; var testAddr; var addrAttr; var localName; var doc = require('./core/files/staffNS.xml').staffNS(); elementList = doc.getElementsByTagName("emp:address"); testAddr = elementList.item(0); assert.notEqual(testAddr, null, 'testAddr should be null'); addrAttr = testAddr.getAttributeNode("emp:domestic"); localName = addrAttr.localName; assert.equal(localName, "domestic", "localName"); }); /** * The "getLocalName()" method for a Node returns the local part of the qualified name of this node, and for nodes of any type other than ELEMENT_NODE and ATTRIBUTE_NODE and nodes created with a DOM Level 1 method, this is null. Create an new Element with the createElement() method. Invoke the "getLocalName()" method on the newly created element node will cause "null" to be returned. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-NodeNSLocalN */ specify('localName02', () => { var success; var createdNode; var localName; var doc = require('./core/files/staffNS.xml').staffNS(); createdNode = doc.createElement("test:employee"); localName = createdNode.localName; assert.equal(localName, 'test:employee', 'localName should be "test:employee"'); }); /** * The "getLocalName()" method for a Node returns the local part of the qualified name of this node, and for nodes of any type other than ELEMENT_NODE and ATTRIBUTE_NODE and nodes created with a DOM Level 1 method, this is null. Retrieve the first employeeId node and get the first child of this node. Since the first child is Text node invoking the "getLocalName()" method will cause "null" to be returned. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-NodeNSLocalN */ specify('localName03', () => { var success; var elementList; var testEmployee; var textNode; var localName; var doc = require('./core/files/staffNS.xml').staffNS(); elementList = doc.getElementsByTagName("employeeId"); testEmployee = elementList.item(0); textNode = testEmployee.firstChild; localName = textNode.localName; assert.equal(localName, null, 'localName should not be null'); }); /** * The "getLocalName()" method for a Node returns the local part of the qualified name of this node, and for nodes of any type other than ELEMENT_NODE and ATTRIBUTE_NODE and nodes created with a DOM Level 1 method, this is null. Retrieve the first employee node and invoke the "getLocalName()" method. The method should return "employee". * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-NodeNSLocalN */ specify('localName04', () => { var success; var elementList; var testEmployee; var employeeLocalName; var doc = require('./core/files/staffNS.xml').staffNS(); elementList = doc.getElementsByTagName("employee"); testEmployee = elementList.item(0); employeeLocalName = testEmployee.localName; assert.equal(employeeLocalName, "employee", "lname"); }); }); describe('namednodemapgetnameditemns', () => { /** * The method getNamedItemNS retrieves a node specified by local name and namespace URI. Using the method getNamedItemNS, retreive an attribute node having namespaceURI=http://www.nist.gov and localName=domestic, from a NamedNodeMap of attribute nodes, for the second element whose namespaceURI=http://www.nist.gov and localName=address. Verify if the attr node has been retreived successfully by checking its nodeName atttribute. * @author IBM * @author Neil Delima * @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-getNamedItemNS */ specify('namednodemapgetnameditemns02', () => { var success; var attributes; var element; var attribute; var elementList; var attrName; var doc = require('./core/files/staffNS.xml').staffNS(); elementList = doc.getElementsByTagNameNS("http://www.nist.gov","address"); element = elementList.item(1); attributes = element.attributes; attribute = attributes.getNamedItemNS("http://www.nist.gov","domestic"); attrName = attribute.name; assert.equal(attrName, "emp:domestic", "namednodemapgetnameditemns02"); }); /** * The method getNamedItemNS retrieves a node specified by local name and namespace URI. Create a new Element node and add 2 new attribute nodes having the same local name but different namespace names and namespace prefixes to it. Using the getNamedItemNS retreive the second attribute node. Verify if the attr node has been retreived successfully by checking its nodeName atttribute. * @author IBM * @author Neil Delima * @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-getNamedItemNS */ specify('namednodemapgetnameditemns03', () => { var success; var attributes; var element; var attribute; var newAttr1; var newAttr2; var newAttribute; var attrName; var doc = require('./core/files/staffNS.xml').staffNS(); element = doc.createElementNS("http://www.w3.org/DOM/Test","root"); newAttr1 = doc.createAttributeNS("http://www.w3.org/DOM/L1","L1:att"); newAttribute = element.setAttributeNodeNS(newAttr1); newAttr2 = doc.createAttributeNS("http://www.w3.org/DOM/L2","L2:att"); newAttribute = element.setAttributeNodeNS(newAttr2); attributes = element.attributes; attribute = attributes.getNamedItemNS("http://www.w3.org/DOM/L2","att"); attrName = attribute.name; assert.equal(attrName, "L2:att", "namednodemapgetnameditemns03"); }); /** * The method getNamedItemNS retrieves a node specified by local name and namespace URI. Retreive the second address element node having localName=adrress. Create a new attribute node having the same name as an existing node but different namespaceURI and add it to this element. Using the getNamedItemNS retreive the newly created attribute node from a nodemap of attributes of the retreive element node. Verify if the attr node has been retreived successfully by checking its nodeName atttribute. * @author IBM * @author Neil Delima * @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-getNamedItemNS */ specify('namednodemapgetnameditemns04', () => { var success; var attributes; var element; var attribute; var newAttr1; var newAttribute; var elementList; var attrName; var doc = require('./core/files/staffNS.xml').staffNS(); elementList = doc.getElementsByTagNameNS("*","address"); element = elementList.item(1); newAttr1 = doc.createAttributeNS("http://www.w3.org/DOM/L1","street"); newAttribute = element.setAttributeNodeNS(newAttr1); attributes = element.attributes; attribute = attributes.getNamedItemNS("http://www.w3.org/DOM/L1","street"); attrName = attribute.name; assert.equal(attrName, "street", "namednodemapgetnameditemns04"); }); /** * The method getNamedItemNS retrieves a node specified by local name and namespace URI. Retreieve the second address element and its attribute into a named node map. Try retreiving the street attribute from the namednodemap using the default namespace uri and the street attribute name. Since the default namespace doesnot apply to attributes this should return null. * @author IBM * @author Neil Delima * @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-getNamedItemNS */ specify('namednodemapgetnameditemns05', () => { var success; var attributes; var element; var attribute; var elementList; var doc = require('./core/files/staffNS.xml').staffNS(); elementList = doc.getElementsByTagNameNS("*","address"); element = elementList.item(1); attributes = element.attributes; attribute = attributes.getNamedItemNS("*","street"); assert.equal(attribute, null, 'attribute should not be null'); }); /** * Retreive the second address element node having localName=adrress. Retreive the attributes of this element into 2 nodemaps. Create a new attribute node and add it to this element. Since NamedNodeMaps are live each one should get updated, using the getNamedItemNS retreive the newly created attribute from each node map. Verify if the attr node has been retreived successfully by checking its nodeName atttribute. * @author IBM * @author Neil Delima * @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-getNamedItemNS */ specify('namednodemapgetnameditemns06', () => { var success; var attributesMap1; var attributesMap2; var element; var attribute; var newAttr1; var newAttribute; var elementList; var attrName; var doc = require('./core/files/staffNS.xml').staffNS(); elementList = doc.getElementsByTagNameNS("*","address"); element = elementList.item(1); attributesMap1 = element.attributes; attributesMap2 = element.attributes; newAttr1 = doc.createAttributeNS("http://www.w3.org/DOM/L1","street"); newAttribute = element.setAttributeNodeNS(newAttr1); attribute = attributesMap1.getNamedItemNS("http://www.w3.org/DOM/L1","street"); attrName = attribute.name; assert.equal(attrName, "street", "namednodemapgetnameditemnsMap106"); attribute = attributesMap2.getNamedItemNS("http://www.w3.org/DOM/L1","street"); attrName = attribute.name; assert.equal(attrName, "street", "namednodemapgetnameditemnsMap206"); }); }); describe('namednodemapremovenameditemns', () => { /** * The method removeNamedItemNS removes a node specified by local name and namespace Retreive an attribute node and then remove from the NamedNodeMap. Verify if the attribute node was actually remove from the node map. * @author IBM * @author Neil Delima * @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-D58B193 */ specify('namednodemapremovenameditemns01', () => { var success; var attributes; var element; var attribute; var elementList; var doc = require('./core/files/staffNS.xml').staffNS(); elementList = doc.getElementsByTagNameNS("http://www.nist.gov","address"); element = elementList.item(1); attributes = element.attributes; attribute = attributes.removeNamedItemNS("http://www.nist.gov","domestic"); attribute = attributes.getNamedItemNS("http://www.nist.gov","domestic"); assert.equal(attribute, null, 'attribute should not be null'); }); /** * The method removeNamedItemNS removes a node specified by local name and namespace Create a new element node and add 2 new attribute nodes to it that have the same localName but different namespaceURI's. Remove the first attribute node from the namedNodeMap of the new element node and check to see that the second attribute still exists. * @author IBM * @author Neil Delima * @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-D58B193 */ specify('namednodemapremovenameditemns03', () => { var success; var attributes; var element; var attribute; var newAttribute; var attribute1; var attribute2; var nodeName; var doc = require('./core/files/staffNS.xml').staffNS(); element = doc.createElementNS("http://www.w3.org/DOM/Test","root"); attribute1 = doc.createAttributeNS("http://www.w3.org/DOM/L1","L1:att"); newAttribute = element.setAttributeNodeNS(attribute1); attribute2 = doc.createAttributeNS("http://www.w3.org/DOM/L2","L2:att"); newAttribute = element.setAttributeNodeNS(attribute2); attributes = element.attributes; attribute = attributes.removeNamedItemNS("http://www.w3.org/DOM/L1","att"); attribute = attributes.getNamedItemNS("http://www.w3.org/DOM/L2","att"); nodeName = attribute.name; assert.equal(nodeName, "L2:att", "namednodemapremovenameditemns02"); }); /** * The method removeNamedItemNS removes a node specified by local name and namespace Attempt to remove the xmlns and dmstc attributes of the first element node with the localName employee. Verify if the 2 attributes were successfully removed. * @author IBM * @author Neil Delima * @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-D58B193 */ specify('namednodemapremovenameditemns04', () => { var success; var attributes; var element; var attribute; var attributeRemoved; var elementList; var doc = require('./core/files/staffNS.xml').staffNS(); elementList = doc.getElementsByTagNameNS("*","employee"); element = elementList.item(0); attributes = element.attributes; attributeRemoved = attributes.removeNamedItemNS("http://www.w3.org/2000/xmlns/","xmlns"); attribute = attributes.getNamedItemNS("http://www.w3.org/2000/xmlns/","xmlns"); assert.equal(attribute, null, 'attribute should not be null'); attributeRemoved = attributes.removeNamedItemNS("http://www.w3.org/2000/xmlns/","dmstc"); attribute = attributes.getNamedItemNS("http://www.w3.org/2000/xmlns/","dmstc"); assert.equal(attribute, null, 'attribute should not be null'); }); /** * The method removeNamedItemNS removes a node using its namespaceURI and localName and raises a NOT_FOUND_ERR if there is no node with the specified namespaceURI and localName in this map Retreive an attribute node into a namednodemap. While removing it from the map specify an incorrect namespaceURI. This should raise a NOT_FOUND_ERR. * @author IBM * @author Neil Delima * @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-D58B193 */ specify('namednodemapremovenameditemns06', () => { var success; var attributes; var element; var attribute; var elementList; var doc = require('./core/files/staffNS.xml').staffNS(); elementList = doc.getElementsByTagNameNS("http://www.nist.gov","employee"); element = elementList.item(1); attributes = element.attributes; { success = false; try { attribute = attributes.removeNamedItemNS("http://www.Nist.gov","domestic"); } catch(ex) { success = (typeof(ex.code) != 'undefined' && ex.code == 8); } assert.ok(success, 'throw_NOT_FOUND_ERR'); } }); /** * The method removeNamedItemNS removes a node using its namespaceURI and localName and raises a NOT_FOUND_ERR if there is no node with the specified namespaceURI and localName in this map Retreive an attribute node from a namednodemap. While removing it from the map specify an incorrect localName. This should raise a NOT_FOUND_ERR. * @author IBM * @author Neil Delima * @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-D58B193 */ specify('namednodemapremovenameditemns07', () => { var success; var attributes; var element; var attribute; var elementList; var doc = require('./core/files/staffNS.xml').staffNS(); elementList = doc.getElementsByTagNameNS("http://www.nist.gov","employee"); element = elementList.item(1); attributes = element.attributes; { success = false; try { attribute = attributes.removeNamedItemNS("http://www.nist.gov","domestic"); } catch(ex) { success = (typeof(ex.code) != 'undefined' && ex.code == 8); } assert.ok(success, 'throw_NOT_FOUND_ERR'); } }); /** * The method removeNamedItemNS removes a node using its namespaceURI and localName and raises a NOT_FOUND_ERR if there is no node with the specified namespaceURI and localName in this map Retreive an attribute node from a namednodemap. Remove the attribute node from the document object. Since NamedNodeMaps are live it should also automatically get removed from the node map. * @author IBM * @author Neil Delima * @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-D58B193 */ specify('namednodemapremovenameditemns08', () => { var success; var attributes; var element; var attribute; var elementList; var doc = require('./core/files/staffNS.xml').staffNS(); elementList = doc.getElementsByTagNameNS("http://www.nist.gov","address"); element = elementList.item(1); attributes = element.attributes; assert.equal(element.removeAttributeNS("http://www.nist.gov","domestic"), undefined, "should be undefined"); { success = false; try { attribute = attributes.removeNamedItemNS("http://www.nist.gov","domestic"); } catch(ex) { success = (typeof(ex.code) != 'undefined' && ex.code == 8); } assert.ok(success, 'throw_NOT_FOUND_ERR'); } }); /** * The method removeNamedItemNS removes a node using its namespaceURI and localName and raises a NOT_FOUND_ERR if there is no node with the specified namespaceURI and localName in this map Retreive an attribute node. Remove the attribute node from the node map. Check the element object to ensure that the attribute node has been removed from it. * @author IBM * @author Neil Delima * @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-D58B193 */ specify('namednodemapremovenameditemns09', () => { var success; var attributes; var newAttributes; var element; var attribute; var elementList; var doc = require('./core/files/staffNS.xml').staffNS(); elementList = doc.getElementsByTagNameNS("http://www.nist.gov","address"); element = elementList.item(1); attributes = element.attributes; attribute = attributes.removeNamedItemNS("http://www.nist.gov","domestic"); newAttributes = element.attributes; attribute = newAttributes.getNamedItemNS("http://www.nist.gov","domestic"); assert.equal(attribute, null, 'attribute should not be null'); }); }); describe('namednodemapsetnameditemns', () => { /** * The method setNamedItemNS adds a node using its namespaceURI and localName. If a node with that namespace URI and that local name is already present in this map, it is replaced by the new one. Retreive the first element whose localName is address and namespaceURI http://www.nist.gov", and put its attributes into a named node map. Create a new attribute node and add it to this map. Verify if the attr node was successfully added by checking the nodeName of the retreived atttribute. * @author IBM * @author Neil Delima * @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-getNamedItemNS */ specify('namednodemapsetnameditemns01', () => { var success; var attributes; var element; var attribute; var newAttribute; var newAttr1; var elementList; var attrName; var doc = require('./core/files/staffNS.xml').staffNS(); elementList = doc.getElementsByTagNameNS("http://www.nist.gov","address"); element = elementList.item(0); attributes = element.attributes; newAttr1 = doc.createAttributeNS("http://www.w3.org/DOM/L1","streets"); newAttribute = element.setAttributeNodeNS(newAttr1); attribute = attributes.getNamedItemNS("http://www.w3.org/DOM/L1","streets"); attrName = attribute.name; assert.equal(attrName, "streets", "namednodemapsetnameditemns01"); }); /** * The method setNamedItemNS adds a node using its namespaceURI and localName. If a node with that namespace URI and that local name is already present in this map, it is replaced by the new one. Create a new element and attribute Node and add the newly created attribute node to the elements NamedNodeMap. Verify if the new attr node has been successfully added to the map by checking the nodeName of the retreived atttribute from the list of attribute nodes in this map. * @author IBM * @author Neil Delima * @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-setNamedItemNS */ specify('namednodemapsetnameditemns02', () => { var success; var attributes; var element; var attribute; var attribute1; var newNode; var attrName; var doc = require('./core/files/staffNS.xml').staffNS(); element = doc.createElementNS("http://www.w3.org/DOM/Test","root"); attribute1 = doc.createAttributeNS("http://www.w3.org/DOM/L1","L1:att"); attributes = element.attributes; newNode = attributes.setNamedItemNS(attribute1); attribute = attributes.getNamedItemNS("http://www.w3.org/DOM/L1","att"); attrName = attribute.name; assert.equal(attrName, "L1:att", "namednodemapsetnameditemns02"); }); /** * Retreieve the first element whose localName is address and its attributes into a named node map. Retreiving the domestic attribute from the namednodemap. Retreieve the second element whose localName is address and its attributes into a named node map. Invoke setNamedItemNS on the second NamedNodeMap specifying the first domestic attribute from the first map. This should raise an INUSE_ATTRIBIUTE_ERR. * @author IBM * @author Neil Delima * @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-setNamedItemNS */ specify('namednodemapsetnameditemns06', () => { var success; var attributes; var elementList; var element; var attr; var newNode; var doc = require('./core/files/staffNS.xml').staffNS(); elementList = doc.getElementsByTagNameNS("*","address"); element = elementList.item(0); attributes = element.attributes; attr = attributes.getNamedItemNS("http://www.usa.com","domestic"); element = elementList.item(1); attributes = element.attributes; { success = false; try { newNode = attributes.setNamedItemNS(attr); } catch(ex) { success = (typeof(ex.code) != 'undefined' && ex.code == 10); } assert.ok(success, 'namednodemapsetnameditemns06'); } }); /** * The method setNamedItemNS adds a node using its namespaceURI and localName and raises a INUSE_ATTRIBUTE_ERR Raised if arg is an Attr that is already an attribute of another Element object. Retreieve the attributes of first element whose localName is address into a named node map. Retreive the attribute whose namespaceURI=http://www.usa.com and localName=domestic from the NamedNodeMap. Retreieve the attributes of second element whose localName is address into a named node map. Call the setNamedItemNS method on the second nodemap with the domestic attribute that was retreived and removed from the first nodeMap as an argument. Assuming that when an attribute is removed from a nodemap, it still remains in the domtree his should raise an INUSE_ATTRIBIUTE_ERR. * @author IBM * @author Neil Delima * @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-setNamedItemNS */ specify('namednodemapsetnameditemns07', () => { var success; var attributes; var elementList; var element; var attr; var newNode; var doc = require('./core/files/staffNS.xml').staffNS(); elementList = doc.getElementsByTagNameNS("*","address"); element = elementList.item(0); attributes = element.attributes; attr = attributes.getNamedItemNS("http://www.usa.com","domestic"); element = elementList.item(1); attributes = element.attributes; { success = false; try { newNode = attributes.setNamedItemNS(attr); } catch(ex) { success = (typeof(ex.code) != 'undefined' && ex.code == 10); } assert.ok(success, 'namednodemapsetnameditemns07'); } }); /** * raises a INUSE_ATTRIBUTE_ERR Raised if arg is an Attr that is already an attribute of another Element object. Retreieve the first element whose localName is address and its attributes into a named node map. Retreiving the domestic attribute from the namednodemap. Retreieve the second element whose localName is address and its attributes into a named node map. Invoke setNamedItemNS on the second NamedNodeMap specifying the attribute from the first map. This should raise an INUSE_ATTRIBIUTE_ERR. * @author IBM * @author Neil Delima * @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-setNamedItemNS */ specify('namednodemapsetnameditemns08', () => { var success; var attributes; var elementList; var element; var attr; var newNode; var doc = require('./core/files/staffNS.xml').staffNS(); elementList = doc.getElementsByTagNameNS("*","address"); element = elementList.item(0); attributes = element.attributes; attr = attributes.getNamedItemNS("http://www.usa.com","domestic"); element = elementList.item(1); attributes = element.attributes; { success = false; try { newNode = attributes.setNamedItemNS(attr); } catch(ex) { success = (typeof(ex.code) != 'undefined' && ex.code == 10); } assert.ok(success, 'namednodemapsetnameditemns08'); } }); }); describe('namespaceURI', () => { /** * The "getNamespaceURI()" method for an Attribute returns the namespace URI of this node, or null if unspecified. Retrieve the first "emp:address" node which has an attribute of "emp:district" that is specified in the DTD. Invoke the "getNamespaceURI()" method on the attribute. The method should return "http://www.nist.gov". * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-NodeNSname * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=238 */ specify('namespaceURI01', () => { var success; var elementList; var testAddr; var addrAttr; var attrNamespaceURI; var doc = require('./core/files/staffNS.xml').staffNS(); elementList = doc.getElementsByTagName("emp:address"); testAddr = elementList.item(0); addrAttr = testAddr.getAttributeNodeNS("http://www.nist.gov","district"); attrNamespaceURI = addrAttr.namespaceURI; assert.equal(attrNamespaceURI, "http://www.nist.gov", "namespaceURI"); }); /** * The "getNamespaceURI()" method for an Attribute returns the namespace URI of this node, or null if unspecified. Retrieve the first emp:address node and get the emp:domestic attribute. Invoke the "getNamespaceURI()" method on the attribute. The method should return "http://www.nist.gov". * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-NodeNSname */ specify('namespaceURI02', () => { var success; var elementList; var testAddr; var addrAttr; var attrNamespaceURI; var doc = require('./core/files/staffNS.xml').staffNS(); elementList = doc.getElementsByTagName("emp:address"); testAddr = elementList.item(0); assert.notEqual(testAddr, null, 'testAddr should be null'); addrAttr = testAddr.getAttributeNodeNS("http://www.nist.gov","domestic"); attrNamespaceURI = addrAttr.namespaceURI; assert.equal(attrNamespaceURI, "http://www.nist.gov", "namespaceURI"); }); /** * The "getNamespaceURI()" method for a Node returns the namespace URI of this node, or null if unspecified. Retrieve the first employee node and invoke the "getNamespaceURI()" method. The method should return "http://www.nist.gov". * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-NodeNSname */ specify('namespaceURI03', () => { var success; var elementList; var testEmployee; var employeeNamespace; var doc = require('./core/files/staffNS.xml').staffNS(); elementList = doc.getElementsByTagName("employee"); testEmployee = elementList.item(0); assert.notEqual(testEmployee, null, 'testEmployee should be null'); employeeNamespace = testEmployee.namespaceURI; assert.equal(employeeNamespace, "http://www.nist.gov", "namespaceURI"); }); /** * The "getNamespaceURI()" method for a Node returns the namespace URI of this node, or null if unspecified. Retrieve the second employee node and invoke the "getNamespaceURI()" method. The method should return "null". * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-NodeNSname */ specify('namespaceURI04', () => { var success; var elementList; var testEmployee; var employeeNamespace; var doc = require('./core/files/staffNS.xml').staffNS(); elementList = doc.getElementsByTagName("employee"); testEmployee = elementList.item(1); employeeNamespace = testEmployee.namespaceURI; assert.equal(employeeNamespace, null, 'employeeNamespace should not be null'); }); }); describe('nodegetlocalname', () => { /** * The method getLocalName returns the local part of the qualified name of this node. Ceate two new element nodes and atribute nodes, with and without namespace prefixes. Retreive the local part of their qualified names using getLocalName and verrify if it is correct. * @author IBM * @author Neil Delima * @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-NodeNSLocalN */ specify('nodegetlocalname03', () => { var success; var element; var qelement; var attr; var qattr; var localElemName; var localQElemName; var localAttrName; var localQAttrName; var doc = require('../level1/core/files/staff.xml').staff(); element = doc.createElementNS("http://www.w3.org/DOM/Test/elem","elem"); qelement = doc.createElementNS("http://www.w3.org/DOM/Test/elem","qual:qelem"); attr = doc.createAttributeNS("http://www.w3.org/DOM/Test/attr","attr"); qattr = doc.createAttributeNS("http://www.w3.org/DOM/Test/attr","qual:qattr"); localElemName = element.localName; localQElemName = qelement.localName; localAttrName = attr.localName; localQAttrName = qattr.localName; assert.equal(localElemName, "elem", "nodegetlocalname03_localElemName"); assert.equal(localQElemName, "qelem", "nodegetlocalname03_localQElemName"); assert.equal(localAttrName, "attr", "nodegetlocalname03_localAttrName"); assert.equal(localQAttrName, "qattr", "nodegetlocalname03_localQAttrName"); }); /** * The method getNamespaceURI returns the namespace URI of this node, or null if it is unspecified For nodes of any type other than ELEMENT_NODE and ATTRIBUTE_NODE and nodes created with a DOM Level 1 method, such as createElement from the Document interface, this is always null. Ceate two new element nodes and atribute nodes, with and without namespace prefixes. Retreive their namespaceURI's using getNamespaceURI and verrify if it is correct. * @author IBM * @author Neil Delima * @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-NodeNSname * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=259 */ specify('nodegetnamespaceuri03', () => { var success; var element; var elementNS; var attr; var attrNS; var elemNSURI; var elemNSURINull; var attrNSURI; var attrNSURINull; var nullNS = null; var doc = require('../level1/core/files/staff.xml').staff(); element = doc.createElementNS(nullNS,"elem"); elementNS = doc.createElementNS("http://www.w3.org/DOM/Test/elem","qual:qelem"); attr = doc.createAttributeNS(nullNS,"attr"); attrNS = doc.createAttributeNS("http://www.w3.org/DOM/Test/attr","qual:qattr"); elemNSURI = elementNS.namespaceURI; elemNSURINull = element.namespaceURI; attrNSURI = attrNS.namespaceURI; attrNSURINull = attr.namespaceURI; assert.equal(elemNSURI, "http://www.w3.org/DOM/Test/elem", "nodegetnamespaceuri03_elemNSURI"); assert.equal(elemNSURINull, null, 'elemNSURINull should not be null'); assert.equal(attrNSURI, "http://www.w3.org/DOM/Test/attr", "nodegetnamespaceuri03_attrNSURI"); assert.equal(attrNSURINull, null, 'attrNSURINull should not be null'); }); /** * The method getOwnerDocument returns the Document object associated with this node Create a new DocumentType node. * @author IBM * @author Neil Delima * @see http://www.w3.org/TR/DOM-Level-2-Core/core#node-ownerDoc * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=259 */ specify('nodegetownerdocument01', () => { var success; var ownerDoc; var domImpl; var docType; var nullID = null; var doc = require('../level1/core/files/staff.xml').staff(); domImpl = doc.implementation; docType = domImpl.createDocumentType("mydoc",nullID,nullID); ownerDoc = docType.ownerDocument; assert.equal(ownerDoc, doc, 'ownerDoc should not be null'); }); /** * The method getOwnerDocument returns the Document object associated with this node Create a new Document node. Since this node is not used with any Document yet verify if the ownerDocument is null. Create a new element Node on the new Document object. Check the ownerDocument of the new element node. * @author IBM * @author Neil Delima * @see http://www.w3.org/TR/DOM-Level-2-Core/core#node-ownerDoc * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=259 */ specify('nodegetownerdocument02', () => { var success; var newDoc; var newElem; var ownerDocDoc; var ownerDocElem; var domImpl; var docType; var nullNS = null; var doc = require('../level1/core/files/staff.xml').staff(); domImpl = doc.implementation; docType = domImpl.createDocumentType("mydoc",nullNS,nullNS); newDoc = domImpl.createDocument("http://www.w3.org/DOM/Test","mydoc",docType); ownerDocDoc = newDoc.ownerDocument; assert.equal(ownerDocDoc, null, 'ownerDocDoc should not be null'); newElem = newDoc.createElementNS("http://www.w3.org/DOM/Test","myelem"); ownerDocElem = newElem.ownerDocument; assert.notEqual(ownerDocElem, null, 'ownerDocElem should be null'); }); /** * The method getPrefix returns the namespace prefix of this node, or null if it is unspecified. Ceate two new element nodes and atribute nodes, with and without namespace prefixes. Retreive the prefix part of their qualified names using getPrefix and verify if it is correct. * @author IBM * @author Neil Delima * @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-NodeNSPrefix */ specify('nodegetprefix03', () => { var success; var element; var qelement; var attr; var qattr; var elemNoPrefix; var elemPrefix; var attrNoPrefix; var attrPrefix; var doc = require('../level1/core/files/staff.xml').staff(); element = doc.createElementNS("http://www.w3.org/DOM/Test/elem","elem"); qelement = doc.createElementNS("http://www.w3.org/DOM/Test/elem","qual:qelem"); attr = doc.createAttributeNS("http://www.w3.org/DOM/Test/attr","attr"); qattr = doc.createAttributeNS("http://www.w3.org/DOM/Test/attr","qual:qattr"); elemNoPrefix = element.prefix; elemPrefix = qelement.prefix; attrNoPrefix = attr.prefix; attrPrefix = qattr.prefix; assert.equal(elemNoPrefix, null, 'elemNoPrefix should not be null'); assert.equal(elemPrefix, "qual", "nodegetprefix03_2"); assert.equal(attrNoPrefix, null, 'attrNoPrefix should not be null'); assert.equal(attrPrefix, "qual", "nodegetprefix03_4"); }); }); describe('nodehasattributes', () => { /** * The method hasAttributes returns whether this node (if it is an element) has any attributes. Retreive an element node without attributes. Verify if hasAttributes returns false. Retreive another element node with attributes. Verify if hasAttributes returns true. * @author IBM * @author Neil Delima * @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-NodeHasAttrs */ specify('nodehasattributes01', () => { var success; var element; var elementList; var hasAttributes; var doc = require('../level1/core/files/staff.xml').staff(); elementList = doc.getElementsByTagName("employee"); element = elementList.item(0); hasAttributes = element.hasAttributes(); assert.equal(hasAttributes, false, 'hasAttributes should be *false*'); elementList = doc.getElementsByTagName("address"); element = elementList.item(0); hasAttributes = element.hasAttributes(); assert.ok(hasAttributes, 'nodehasattributes01_2'); }); /** * The method hasAttributes returns whether this node (if it is an element) has any attributes. Create a new Document, Element and Attr node. Add the Attr to the Element and append the Element to the Document. Retreive the newly created element node from the document and check if it has attributes using hasAttributes. * @author IBM * @author Neil Delima * @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-NodeHasAttrs */ specify('nodehasattributes04', () => { var success; var newDoc; var docType = null; var domImpl; var element; var elementTest; var elementDoc; var attribute; var setNode; var appendedChild; var elementList; var hasAttributes; var doc = require('./core/files/staffNS.xml').staffNS(); domImpl = doc.implementation; newDoc = domImpl.createDocument("http://www.w3.org/DOM/Test","test",docType); element = newDoc.createElementNS("http://www.w3.org/DOM/Test","dom:elem"); attribute = newDoc.createAttribute("attr"); setNode = element.setAttributeNode(attribute); elementDoc = newDoc.documentElement; appendedChild = elementDoc.appendChild(element); elementList = newDoc.getElementsByTagNameNS("http://www.w3.org/DOM/Test","elem"); elementTest = elementList.item(0); hasAttributes = elementTest.hasAttributes(); assert.ok(hasAttributes, 'nodehasattributes04'); }); }); describe('nodenormalize', () => { /** * The "normalize()" method puts all the nodes in the full depth of the sub-tree underneath this element into a "normal" form. Retrieve the third employee and access its second child. This child contains a block of text that is spread across multiple lines. The content of the "name" child should be parsed and treated as a single Text node. This appears to be a duplicate of elementnormalize.xml in DOM L1 Test Suite * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-normalize * @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-72AB8359 */ specify('normalize01', () => { var success; var root; var elementList; var firstChild; var textList; var textNode; var data; var doc = require('../level1/core/files/staff.xml').staff(); root = doc.documentElement; root.normalize(); elementList = root.getElementsByTagName("name"); firstChild = elementList.item(2); textList = firstChild.childNodes; textNode = textList.item(0); data = textNode.data; assert.equal(data, "Roger\n Jones", "data"); }); }); describe('ownerDocument', () => { /** * The "getOwnerDocument()" method returns null if the target node itself is a DocumentType which is not used with any document yet. Invoke the "getOwnerDocument()" method on the master document. The DocumentType returned should be null. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/DOM-Level-2-Core/core#node-ownerDoc */ specify('ownerDocument01', () => { var success; var ownerDocument; var doc = require('../level1/core/files/staff.xml').staff(); ownerDocument = doc.ownerDocument; assert.equal(ownerDocument, null, 'ownerDocument should not be null'); }); /** * The "getOwnerElement()" will return the Element node this attribute is attached to or null if this attribute is not in use. Get the "domestic" attribute from the first "address" node. Apply the "getOwnerElement()" method to get the Element associated with the attribute. The value returned should be "address". * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-F68D095 */ specify('ownerElement01', () => { var success; var addressList; var testNode; var attributes; var domesticAttr; var elementNode; var name; var doc = require('../level1/core/files/staff.xml').staff(); addressList = doc.getElementsByTagName("address"); testNode = addressList.item(0); attributes = testNode.attributes; domesticAttr = attributes.getNamedItem("domestic"); elementNode = domesticAttr.ownerElement; name = elementNode.nodeName; assert.equal(name, "address", "throw_Equals"); }); /** * The "getOwnerElement()" will return the Element node this attribute is attached to or null if this attribute is not in use. Create a new attribute. Apply the "getOwnerElement()" method to get the Element associated with the attribute. The value returned should be "null" since this attribute is not in use. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/DOM-Level-2-Core/core#Attr-ownerElement */ specify('ownerElement02', () => { var success; var newAttr; var elementNode; var doc = require('../level1/core/files/staff.xml').staff(); newAttr = doc.createAttribute("newAttribute"); elementNode = newAttr.ownerElement; assert.equal(elementNode, null, 'elementNode should not be null'); }); }); describe('prefix', () => { /** * The "getPrefix()" method for a Node returns the namespace prefix of the node, and for nodes of any type other than ELEMENT_NODE and ATTRIBUTE_NODE and nodes created with a DOM Level 1 method, this is null. Create an new Element with the createElement() method. Invoke the "getPrefix()" method on the newly created element node will cause "null" to be returned. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-NodeNSPrefix */ specify('prefix01', () => { var success; var createdNode; var prefix; var doc = require('./core/files/staffNS.xml').staffNS(); createdNode = doc.createElement("test:employee"); prefix = createdNode.prefix; assert.equal(prefix, null, 'prefix should not be null'); }); /** * The "getPrefix()" method returns the namespace prefix of this node, or null if unspecified. For nodes of any type other than ELEMENT_NODE and ATTRIBUTE_NODE, this is always null. Retrieve the first emp:employeeId node and get the first child of this node. Since the first child is Text node invoking the "getPrefix()" method will cause "null" to be returned. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-NodeNSPrefix */ specify('prefix02', () => { var success; var elementList; var testEmployee; var textNode; var prefix; var doc = require('./core/files/staffNS.xml').staffNS(); elementList = doc.getElementsByTagName("emp:employeeId"); testEmployee = elementList.item(0); assert.notEqual(testEmployee, null, 'testEmployee should be null'); textNode = testEmployee.firstChild; prefix = textNode.prefix; assert.equal(prefix, null, 'prefix should not be null'); }); /** * The "getPrefix()" method for a node returns the namespace prefix of this node, or null if it is unspecified. Retrieve the first emp:employee node and invoke the getPrefix() method." The method should return "emp". * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-NodeNSPrefix */ specify('prefix03', () => { var success; var elementList; var testEmployee; var prefix; var doc = require('./core/files/staffNS.xml').staffNS(); elementList = doc.getElementsByTagName("emp:employee"); testEmployee = elementList.item(0); assert.notEqual(testEmployee, null, 'testEmployee should be null'); prefix = testEmployee.prefix; assert.equal(prefix, "emp", "prefix"); }); /** * The "getPrefix()" method for a node returns the namespace prefix of this node, or null if it is unspecified. Retrieve the first employee node and invoke the getPrefix() method." The method should return "null". * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-NodeNSPrefix */ specify('prefix04', () => { var success; var elementList; var testEmployee; var prefix; var doc = require('./core/files/staffNS.xml').staffNS(); elementList = doc.getElementsByTagName("employee"); testEmployee = elementList.item(0); prefix = testEmployee.prefix; assert.equal(prefix, null, 'prefix should not be null'); }); /** * The "getPublicId()" method of a documenttype node contains the public identifier associated with the external subset. Retrieve the documenttype. Apply the "getPublicId()" method. The string "STAFF" should be returned. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-Core-DocType-publicId */ specify('publicId01', () => { var success; var docType; var publicId; var doc = require('./core/files/staffNS.xml').staffNS(); docType = doc.doctype; publicId = docType.publicId; assert.equal(publicId, "STAFF", "throw_Equals"); }); }); describe('remove attribute or namedItem NS', () => { /** * (This test is not from the w3.org test suite but specific to jsdom.) The "removeAttributeNS(namespaceURI,localName)" does not raise NOT_FOUND_ERR if the attribute is not present. Remove the attribute "{http://nonexistent}local" from emp:address node by invoking the "removeAttributeNS(namespaceURI,localName)" method. * @author Louis-Dominique Dubeau * @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElRemAtNS * @see http://www.w3.org/2000/11/DOM-Level-2-errata#core-19 * @see http://dom.spec.whatwg.org/#dom-element-removeattributens */ specify('removeAttributeNS03', () => { var doc = require('./core/files/staffNS.xml').staffNS(); var elementList = doc.getElementsByTagName("emp:address"); var testAddr = elementList.item(0); assert.equal(testAddr.removeAttributeNS("http://nonexistent","nonexistent"), undefined, "should be undefined"); }); /** * The "removeNamedItemNS(namespaceURI,localName)" method for a NamedNodeMap should remove a node specified by localName and namespaceURI. Retrieve a list of elements with tag name "address". Access the second element from the list and get its attributes. Try to remove the attribute node with local name "domestic" and namespace uri "http://www.usa.com" with method removeNamedItemNS(namespaceURI,localName). Check to see if the node has been removed. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-1074577549 */ specify('removeNamedItemNS01', () => { var doc = require('./core/files/staffNS.xml').staffNS(); var testAddress = doc.getElementsByTagName("address").item(1); var attributes = testAddress.attributes; var removedNode = attributes.removeNamedItemNS("http://www.usa.com","domestic"); assert.notEqual(removedNode, null, 'removedNode should not be null'); var newAttr = attributes.getNamedItem("dmstc:domestic"); assert.equal(newAttr, null, 'newAttr should be null'); }); /** * The "removeNamedItemNS(namespaceURI,localName)" method for a NamedNodeMap should raise NOT_FOUND_ERR DOMException if there is no node with the specified namespaceURI and localName in this map. Retrieve a list of elements with tag name "address". Access the second element from the list and get its attributes. Try to remove an attribute node with local name "domest" and namespace uri "http://www.usa.com" with method removeNamedItemNS(namespaceURI,localName). This should raise NOT_FOUND_ERR DOMException. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-258A00AF')/constant[@name='NOT_FOUND_ERR']) * @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-removeNamedItemNS * @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-removeNamedItemNS')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NOT_FOUND_ERR']) */ specify('removeNamedItemNS02', () => { var doc = require('./core/files/staffNS.xml').staffNS(); var success; var namespaceURI = "http://www.usa.com"; var localName = "domest"; var elementList; var testAddress; var attributes; var removedNode; elementList = doc.getElementsByTagName("address"); testAddress = elementList.item(1); attributes = testAddress.attributes; success = false; try { removedNode = attributes.removeNamedItemNS(namespaceURI,localName); } catch(ex) { success = (typeof(ex.code) != 'undefined' && ex.code == 8); } assert.ok(success, 'throw_NOT_FOUND_ERR') }); }); describe('setAttributeNS', () => { /** * The "setAttributeNS(namespaceURI,qualifiedName,Value)" method raises a INVALID_CHARACTER_ERR DOMException if the specified prefix contains an illegal character. Attempt to add a new attribute on the first employee node. An exception should be raised since the "qualifiedName" has an invalid character. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-258A00AF')/constant[@name='INVALID_CHARACTER_ERR']) * @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElSetAttrNS * @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-ElSetAttrNS')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INVALID_CHARACTER_ERR']) */ specify('setAttributeNS01', () => { var doc = require('./core/files/staffNS.xml').staffNS(); var success; var namespaceURI = "http://www.nist.gov"; var qualifiedName = "emp:qual?name"; var elementList; var testAddr; elementList = doc.getElementsByTagName("employee"); testAddr = elementList.item(0); { success = false; try { testAddr.setAttributeNS(namespaceURI,qualifiedName,"newValue"); } catch(ex) { success = (typeof(ex.code) != 'undefined' && ex.code == 5); } assert.ok(success, 'throw_INVALID_CHARACTER_ERR'); } }); /** * The "setAttributeNS(namespaceURI,qualifiedName,value)" method raises a NAMESPACE_ERR DOMException if the specified qualifiedName if malformed. Attempt to add a new attribute on the second employee node. An exception should be raised since the "qualifiedName" is malformed. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-258A00AF')/constant[@name='NAMESPACE_ERR']) * @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElSetAttrNS * @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-ElSetAttrNS')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NAMESPACE_ERR']) */ specify('setAttributeNS02', () => { var doc = require('./core/files/staffNS.xml').staffNS(); var success; var namespaceURI = "http://www.nist.gov"; var qualifiedName = "emp:"; var elementList; var testAddr; elementList = doc.getElementsByTagName("emp:employee"); testAddr = elementList.item(0); { success = false; try { testAddr.setAttributeNS(namespaceURI,qualifiedName,"newValue"); } catch(ex) { success = (typeof(ex.code) != 'undefined' && ex.code == 5); } assert.ok(success, 'throw_INVALID_CHARACTER_ERR'); } }); /** * The "setAttributeNS(namespaceURI,qualifiedName,value)" method adds a new attribute. If an attribute with the same local name and namespace URI is already present on the element, its prefix is changed to be the prefix part of the "qualifiedName", and its vale is changed to be the "value" paramter. null value if no previously existing Attr node with the same name was replaced. Add a new attribute to the "emp:address" element. Check to see if the new attribute has been successfully added to the document by getting the attributes value, namespace URI, local Name and prefix. The prefix will be changed to the prefix part of the "qualifiedName" and its value changed to the "value" parameter. THE ABOVE IS INVALID. THE DOM STANDARD OVERRIDES THIS BEHAVIOR: now, the value is overridden, but the prefix is left alone. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/DOM-Level-2-Core/core# */ specify('setAttributeNS04_modified', () => { var doc = require('./core/files/staffNS.xml').staffNS(); var resultNamespaceURI; var resultLocalName; var resultPrefix; var testAddr = doc.getElementsByTagName("emp:address").item(0); assert.notEqual(testAddr, null, 'testAddr should not be null'); testAddr.setAttributeNS("http://www.nist.gov","newprefix:zone","newValue"); var addrAttr = testAddr.getAttributeNodeNS("http://www.nist.gov","zone"); var resultAttr = testAddr.getAttributeNS("http://www.nist.gov","zone"); assert.equal(resultAttr, 'newValue'); assert.equal(addrAttr.namespaceURI, 'http://www.nist.gov') assert.equal(addrAttr.localName, 'zone'); assert.equal(addrAttr.prefix, 'emp') }); /** * The "setAttributeNS(namespaceURI,qualifiedName,value)" method adds a new attribute. If an attribute with the same local name and namespace URI is already present on the element, its prefix is changed to be the prefix part of the "qualifiedName", and its vale is changed to be the "value" paramter. null value if no previously existing Attr node with the same name was replaced. Add a new attribute to the "emp:address" element. Check to see if the new attribute has been successfully added to the document. The new attribute "" contains markup and therefore is escaped by the implementation. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElGetAttrNS */ specify('setAttributeNS05', () => { var doc = require('./core/files/staffNS.xml').staffNS(); var localName = "newAttr"; var namespaceURI = "http://www.newattr.com"; var qualifiedName = "emp:newAttr"; var testAddr = doc.getElementsByTagName("emp:address").item(0); assert.notEqual(testAddr, null, 'testAddr should not be null'); testAddr.setAttributeNS(namespaceURI, qualifiedName, ""); var resultAttr = testAddr.getAttributeNS(namespaceURI, localName); assert.equal(resultAttr, ''); }); /** * The "setAttributeNS(namespaceURI,localName,value)" method raises a NAMESPACE_ERR DOMException if the "qualifiedName" has a prefix of "xml" and the namespaceURI is different from http://www.w3.org/XML/1998/namespace. Attempt to add an attribute with a prefix of "xml" as the on the first employee node. An exception should be raised since the namespaceURI of this node is not http://www.w3.org/XML/1998/namespace. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-258A00AF')/constant[@name='NAMESPACE_ERR']) * @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElSetAttrNS * @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-ElSetAttrNS')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NAMESPACE_ERR']) */ specify('setAttributeNS06', () => { var doc = require('./core/files/staffNS.xml').staffNS(); var success; var namespaceURI = "http://www.nist.gov"; var qualifiedName = "xml:qualifiedName"; var elementList; var testAddr; elementList = doc.getElementsByTagName("employee"); testAddr = elementList.item(0); { success = false; try { testAddr.setAttributeNS(namespaceURI,qualifiedName,"newValue"); } catch(ex) { success = (typeof(ex.code) != 'undefined' && ex.code == 14); } assert.ok(success, 'throw_NAMESPACE_ERR'); } }); /** * The "setAttributeNS(namespaceURI,localName,value)" method raises a NAMESPACE_ERR DOMException if the "qualifiedName" has a value of "xmlns" and the namespaceURI is different from http://www.w3.org/2000/xmlns. Attempt to add an attribute with a "qualifiedName" of "xmlns" as the on the first employee node. An exception should be raised since the namespaceURI of this node is not http://www.w3.org/2000/xmlns. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-258A00AF')/constant[@name='NAMESPACE_ERR']) * @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElSetAttrNS * @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-ElSetAttrNS')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NAMESPACE_ERR']) */ specify('setAttributeNS07', () => { var doc = require('./core/files/staffNS.xml').staffNS(); var success; var namespaceURI = "http://www.nist.gov"; var qualifiedName = "xmlns"; var elementList; var testAddr; elementList = doc.getElementsByTagName("employee"); testAddr = elementList.item(0); { success = false; try { testAddr.setAttributeNS(namespaceURI,qualifiedName,"newValue"); } catch(ex) { success = (typeof(ex.code) != 'undefined' && ex.code == 14); } assert.ok(success, 'throw_NAMESPACE_ERR'); } }); /** * The "setAttributeNS(namespaceURI,qualifiedName,value)" method adds a new attribute. If an attribute with the same local name and namespace URI is already present on the element, its prefix is changed to be the prefix part of the "qualifiedName", and its vale is changed to be the "value" paramter. null value if no previously existing Attr node with the same name was replaced. Add a new attribute to the "emp:address" element. Check to see if the new attribute has been successfully added to the document by getting the attributes value, namespace URI, local Name and prefix. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElSetAttrNS */ specify('setAttributeNS09', () => { var doc = require('./core/files/staffNS.xml').staffNS(); var localName = "newAttr"; var namespaceURI = "http://www.newattr.com"; var qualifiedName = "emp:newAttr"; var elementList; var testAddr; var addrAttr; var resultAttr; var resultNamespaceURI; var resultLocalName; var resultPrefix; elementList = doc.getElementsByTagName("emp:address"); testAddr = elementList.item(0); assert.notEqual(testAddr, null, 'testAddr should not be null'); testAddr.setAttributeNS(namespaceURI,qualifiedName,"newValue"); addrAttr = testAddr.getAttributeNodeNS(namespaceURI,localName); resultAttr = testAddr.getAttributeNS(namespaceURI,localName); assert.equal(resultAttr, 'newValue'); assert.equal(addrAttr.namespaceURI, 'http://www.newattr.com'); assert.equal(addrAttr.localName, 'newAttr'); assert.equal(addrAttr.prefix, 'emp'); }); /** * Element.setAttributeNS with an empty qualified name should cause an INVALID_CHARACTER_ERR. * @author Curt Arnold * @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-258A00AF')/constant[@name='INVALID_CHARACTER_ERR']) * @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElSetAttrNS * @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-ElSetAttrNS')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INVALID_CHARACTER_ERR']) * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=525 */ specify('setAttributeNS10', () => { var doc = require('../level1/core/files/hc_staff.xml').hc_staff(); var success; var namespaceURI = "http://www.example.gov"; var elementList; var testAddr; elementList = doc.getElementsByTagName("em"); testAddr = elementList.item(0); { success = false; try { testAddr.setAttributeNS(namespaceURI,"","newValue"); } catch(ex) { success = (typeof(ex.code) != 'undefined' && ex.code == 5); } assert.ok(success, 'throw_INVALID_CHARACTER_ERR'); } }); }); describe('setAttributeNodeNS', () => { /** * The "setAttributeNode(newAttr)" method raises an "INUSE_ATTRIBUTE_ERR DOMException if the "newAttr" is already an attribute of another element. Retrieve the first emp:address and append a newly created element. The "createAttributeNS(namespaceURI,qualifiedName)" and "setAttributeNodeNS(newAttr)" methods are invoked to create and add a new attribute to the newly created Element. The "setAttributeNodeNS(newAttr)" method is once again called to add the new attribute causing an exception to be raised since the attribute is already an attribute of another element. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-258A00AF')/constant[@name='INUSE_ATTRIBUTE_ERR']) * @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElSetAtNodeNS * @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-ElSetAtNodeNS')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INUSE_ATTRIBUTE_ERR']) */ specify('setAttributeNodeNS01', () => { var success; var namespaceURI = "http://www.newattr.com"; var qualifiedName = "emp:newAttr"; var newElement; var newAttr; var elementList; var testAddr; var appendedChild; var setAttr1; var setAttr2; var doc = require('./core/files/staffNS.xml').staffNS(); elementList = doc.getElementsByTagName("emp:address"); testAddr = elementList.item(0); assert.notEqual(testAddr, null, 'empAddrNotNull'); newElement = doc.createElement("newElement"); appendedChild = testAddr.appendChild(newElement); newAttr = doc.createAttributeNS(namespaceURI,qualifiedName); setAttr1 = newElement.setAttributeNodeNS(newAttr); { success = false; try { setAttr2 = testAddr.setAttributeNodeNS(newAttr); } catch(ex) { success = (typeof(ex.code) != 'undefined' && ex.code == 10); } assert.ok(success, 'throw_INUSE_ATTRIBUTE_ERR'); } }); /** * The "setAttributeNodeNS(newAttr)" adds a new attribute. If an attribute with that local name and that namespaceURI is already present in the element, it is replaced by the new one. Retrieve the first emp:address element and add a new attribute to the element. Since an attribute with the same local name and namespaceURI as the newly created attribute does not exist the value "null" is returned. This test uses the "createAttributeNS(namespaceURI,localName) method from the Document interface to create the new attribute to add. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElSetAtNodeNS */ specify('setAttributeNodeNS03', () => { var doc = require('./core/files/staffNS.xml').staffNS(); var testAddr = doc.getElementsByTagName("emp:address").item(0); assert.notEqual(testAddr, null, 'testAddr should not be null'); var newAttr = doc.createAttributeNS('http://www.newattr.com', 'emp:newAttr'); var newAddrAttr = testAddr.setAttributeNodeNS(newAttr); assert.equal(newAddrAttr, null, 'newAddrAttr should be null'); }); /** * The "setAttributeNodeNS(newAttr)" adds a new attribute. If an attribute with that local name and that namespaceURI is already present in the element, it is replaced by the new one. Retrieve the first emp:address element and add a new attribute to the element. Since an attribute with the same local name and namespaceURI already exists, it is replaced by the new one and returns the replaced "Attr" node. This test uses the "createAttributeNS(namespaceURI,localName) method from the Document interface to create the new attribute to add. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-F68D095 */ specify('setAttributeNodeNS04', () => { var doc = require('./core/files/staffNS.xml').staffNS(); var testAddr = doc.getElementsByTagName("emp:address").item(0); assert.notEqual(testAddr, null, 'testAddr should not be null'); var newAttr = doc.createAttributeNS("http://www.nist.gov","xxx:domestic"); var newAddrAttr = testAddr.setAttributeNodeNS(newAttr); assert.equal(newAddrAttr.name, 'emp:domestic') }); }); describe('setNamedItemNS', () => { /** * The "setNamedItemNS(arg)" method for a NamedNodeMap should raise INUSE_ATTRIBUTE_ERR DOMException if arg is an Attr that is already an attribute of another Element object. Retrieve an attr node from the third "address" element whose local name is "domestic" and namespaceURI is "http://www.netzero.com". Invoke method setNamedItemNS(arg) on the map of the first "address" element with arg being the attr node from above. Method should raise INUSE_ATTRIBUTE_ERR DOMException. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-258A00AF')/constant[@name='INUSE_ATTRIBUTE_ERR']) * @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-setNamedItemNS * @see http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-setNamedItemNS')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INUSE_ATTRIBUTE_ERR']) */ specify('setNamedItemNS01', () => { var success; var elementList; var anotherElement; var anotherMap; var arg; var testAddress; var map; var setNode; var doc = require('./core/files/staffNS.xml').staffNS(); elementList = doc.getElementsByTagName("address"); anotherElement = elementList.item(2); anotherMap = anotherElement.attributes; arg = anotherMap.getNamedItemNS("http://www.netzero.com","domestic"); testAddress = elementList.item(0); map = testAddress.attributes; { success = false; try { setNode = map.setNamedItemNS(arg); } catch(ex) { success = (typeof(ex.code) != 'undefined' && ex.code == 10); } assert.ok(success, 'throw_INUSE_ATTRIBUTE_ERR'); } }); /** * The "setNamedItemNS(arg)" method for a NamedNodeMap should add a node using its namespaceURI and localName given that there is no existing node with the same namespaceURI and localName in the map. Create an attr node with namespaceURI "http://www.nist.gov",qualifiedName "prefix:newAttr" and value "newValue". Invoke method setNamedItemNS(arg) on the map of the first "address" element where arg is identified by the namespaceURI and qualifiedName from above. Method should return the newly added attr node. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-F68D080 */ specify('setNamedItemNS03', () => { var namespaceURI = "http://www.nist.gov"; var doc = require('./core/files/staffNS.xml').staffNS(); var arg = doc.createAttributeNS(namespaceURI, "prefix:newAttr"); arg.nodeValue = "newValue"; var attributes = doc.getElementsByTagName("address").item(0).attributes; attributes.setNamedItemNS(arg); var retnode = attributes.getNamedItemNS(namespaceURI,"newAttr"); assert.equal(retnode.nodeValue, 'newValue'); }); /** * The "setNamedItemNS(arg)" method for a NamedNodeMap should replace an existing node n1 found in the map with arg if n1 has the same namespaceURI and localName as arg and return n1. Create an attribute node in with namespaceURI "http://www.usa.com" and qualifiedName "dmstc:domestic" whose value is "newVal". Invoke method setNamedItemNS(arg) on the map of the first "address" element. Method should return the old attribute node identified by namespaceURI and qualifiedName from above,whose value is "Yes". * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElSetAtNodeNS */ specify('setNamedItemNS05', () => { var doc = require('./core/files/staffNS.xml').staffNS(); var arg = doc.createAttributeNS("http://www.usa.com", "dmstc:domestic"); arg.nodeValue = "newValue"; var attributes = doc.getElementsByTagName("address").item(0).attributes; var retnode = attributes.setNamedItemNS(arg); assert.equal(retnode.nodeValue, 'Yes'); }); }); // The "getSystemId()" method of a documenttype node contains the system identifier associated with the external subset. // Retrieve the documenttype. // Apply the "getSystemId()" method. The string "staffNS.dtd" should be returned. // @author NIST // @author Mary Brady // @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-Core-DocType-systemId specify('systemId01', () => { var doc = require('./core/files/staffNS.xml').staffNS(); assert.equal(doc.doctype.systemId, 'staffNS.dtd'); }); /** * Verify that `getElementsByTagNameNS` memoization is cleared * when the document is modified. * * @author Chris Carpita */ specify('memoizationQueriesCleared', () => { var doc = require('./core/files/staffNS.xml').staffNS(); var oldCount = doc.getElementsByTagNameNS("http://www.nist.gov", "address").length; var address = doc.createElementNS("http://www.nist.gov", "address"); doc.getElementsByTagName('employee')[0].appendChild(address); var newCount = doc.getElementsByTagNameNS("http://www.nist.gov", "address").length; assert.equal(newCount, oldCount + 1, "address count should be incremented after adding element w/ matching NS"); }); }); jsdom-19.0.0/test/to-port-to-wpts/level2/core/000077500000000000000000000000001415223704400210365ustar00rootroot00000000000000jsdom-19.0.0/test/to-port-to-wpts/level2/core/files/000077500000000000000000000000001415223704400221405ustar00rootroot00000000000000jsdom-19.0.0/test/to-port-to-wpts/level2/core/files/staffNS.xml.js000066400000000000000000000036451415223704400246510ustar00rootroot00000000000000const { JSDOM } = require("../../../../.."); exports.staffNS = function() { return (new JSDOM(`\ EMP0001Margaret MartinAccountant56,000Female
1230 North Ave. Dallas, Texas 98551
EMP0002Martha Raynolds <![CDATA[This is a CDATASection with EntityReference number 2 &ent2;]]> <![CDATA[This is an adjacent CDATASection with a reference to a tab &tab;]]>Secretary35,000Female
&ent2; Dallas, &ent3; 98554
EMP0003Roger JonesDepartment Manager100,000&ent4;
PO Box 27 Irving, texas 98553
EMP0004Jeny OconnorPersonal Director95,000Female27 South Road. Dallas, texas 98556EMP0005Robert MyersComputer Specialist90,000male
1821 Nordic. Road, Irving Texas 98558
`, { contentType: "application/xml" })).window.document; }; jsdom-19.0.0/test/to-port-to-wpts/level2/events.js000066400000000000000000000536531415223704400217640ustar00rootroot00000000000000"use strict"; const { assert } = require("chai"); const { beforeEach, afterEach, describe, specify } = require("mocha-sugar-free"); const { JSDOM } = require("../../.."); class EventMonitor { constructor() { this.atEvents = []; this.bubbledEvents = []; this.capturedEvents = []; this.allEvents = []; this.handleEvent = function (event) { this.allEvents.push(event); switch (event.eventPhase) { case event.CAPTURING_PHASE: this.capturedEvents.push(event); break; case event.AT_TARGET: this.atEvents.push(event); break; case event.BUBBLING_PHASE: this.bubbledEvents.push(event); break; default: throw new Error("Unspecified event phase"); } }.bind(this); } } var _setUp = function() { var doc = require('../level1/core/files/hc_staff.xml').hc_staff(); var monitor = this.monitor = new EventMonitor(); this.win = doc.defaultView; this.title = doc.getElementsByTagName("title").item(0); this.body = doc.getElementsByTagName("body").item(0); this.plist = doc.getElementsByTagName("p").item(0); this.event = doc.createEvent("Events"); this._handleEvent = function(type) { return(function(event) { event[type](); monitor.handleEvent(event) }); } } var _tearDown = function(xs) { xs = ['monitor', 'title', 'body', 'plist', 'event', '_handleEvent'].concat(xs ? xs : []); var self = this; xs.forEach(function(x){ self[x] = undefined; delete(self[x]); }) } describe("level2/events", () => { // A document is created using implementation.createDocument and cast to a DocumentEvent interface. // @author Curt Arnold // @see http://www.w3.org/TR/DOM-Level-2-Events/events#Events-DocumentEvent specify('DocumentEvent interface', () => { var doc = require('../level1/core/files/hc_staff.xml').hc_staff(); assert.ok((doc.createEvent instanceof Function), "should have createEvent function"); }); // A document is created using implementation.createDocument and cast to a EventTarget interface. // @author Curt Arnold // @see http://www.w3.org/TR/DOM-Level-2-Events/events#Events-EventTarget specify('EventTarget interface', () => { var doc = require('../level1/core/files/hc_staff.xml').hc_staff(); assert.ok((doc instanceof doc.defaultView.EventTarget), 'should be an instance of EventTarget'); }); // An object implementing the Event interface is created by using DocumentEvent.createEvent method with an eventType // @author Curt Arnold // @see http://www.w3.org/TR/DOM-Level-2-Events/events#Events-DocumentEvent-createEvent specify('create event with each event type', () => { var doc = require('../level1/core/files/hc_staff.xml').hc_staff(), event_types = {'Events': doc.defaultView.Event, 'UIEvents': doc.defaultView.UIEvent, 'MouseEvents': doc.defaultView.MouseEvent , 'HTMLEvents': doc.defaultView.Event}; for (var type in event_types) { var event = doc.createEvent(type); assert.notEqual(event, null, "should not be null for " + type); assert.ok((event instanceof event_types[type]),"should be instanceof " + type); } }); // @author Curt Arnold // @see http://www.w3.org/TR/DOM-Level-2-Events/events#Events-EventTarget-dispatchEvent // @see http://www.w3.org/TR/DOM-Level-2-Core/core.html#ID-17189187 describe('dispatch event', () => { beforeEach(() => { this.doc = require('../level1/core/files/hc_staff.xml').hc_staff(); }); afterEach(() => { _tearDown.call(this, 'doc'); }); specify('a null reference passed to dispatchEvent', () => { var doc = this.doc; assert.throws(function(){ doc.dispatchEvent(null) }, TypeError); // TODO: figure out the best way to test (exception.code == 0) and (exception.message == 'Null event') }); specify('a created but not initialized event passed to dispatchEvent', () => { var doc = this.doc, event_types = ['Events', 'UIEvents', 'MouseEvents', 'HTMLEvents']; event_types.forEach(function(type){ assert.throwsDomException(function(){ doc.dispatchEvent(doc.createEvent(type)) }, doc, 'InvalidStateError'); }) }); // An EventListener registered on the target node with capture false, should receive any event fired on that node. specify('EventListener with capture false', () => { var monitor = new EventMonitor(); this.doc.addEventListener("foo", monitor.handleEvent, false); var event = this.doc.createEvent("Events"); event.initEvent("foo",true,false); assert.strictEqual(event.eventPhase, 0); assert.strictEqual(event.currentTarget, null); this.doc.dispatchEvent(event); assert.equal(monitor.atEvents.length, 1, 'should receive atEvent'); assert.equal(monitor.bubbledEvents.length, 0, 'should not receive at bubble phase'); assert.equal(monitor.capturedEvents.length, 0, 'should not receive at capture phase'); assert.strictEqual(event.eventPhase, 0); assert.strictEqual(event.currentTarget, null); }); // An EventListener registered on the target node with capture true, should receive any event fired on that node. specify('EventListener with capture true', () => { var monitor = new EventMonitor(); this.doc.addEventListener("foo", monitor.handleEvent, true); var event = this.doc.createEvent("Events"); event.initEvent("foo",true,false); assert.strictEqual(event.eventPhase, 0); assert.strictEqual(event.currentTarget, null); this.doc.dispatchEvent(event); assert.equal(monitor.atEvents.length, 1, 'should receive atEvent'); assert.equal(monitor.bubbledEvents.length, 0, 'should not receive at bubble phase'); assert.equal(monitor.capturedEvents.length, 0, 'should not receive at capture phase'); assert.strictEqual(event.eventPhase, 0); assert.strictEqual(event.currentTarget, null); }); // The same monitor is registered twice and an event is dispatched. The monitor should receive only one handleEvent call. specify('EventListener is registered twice', () => { var monitor = new EventMonitor(); this.doc.addEventListener("foo", monitor.handleEvent, false); this.doc.addEventListener("foo", monitor.handleEvent, false); var event = this.doc.createEvent("Events"); event.initEvent("foo",true,false); this.doc.dispatchEvent(event); assert.equal(monitor.atEvents.length, 1, 'should receive atEvent only once'); assert.equal(monitor.bubbledEvents.length, 0, 'should not receive at bubble phase'); assert.equal(monitor.capturedEvents.length, 0, 'should not receive at capture phase'); }); // The same monitor is registered twice, removed once, and an event is dispatched. The monitor should receive only no handleEvent calls. specify('EventListener is registered twice, removed once', () => { var monitor = new EventMonitor(); this.doc.addEventListener("foo", monitor.handleEvent, false); this.doc.addEventListener("foo", monitor.handleEvent, false); this.doc.removeEventListener("foo", monitor.handleEvent, false); var event = this.doc.createEvent("Events"); event.initEvent("foo",true,false); this.doc.dispatchEvent(event); assert.equal(monitor.allEvents.length, 0, 'should not receive any handleEvent calls'); }); // A monitor is added, multiple calls to removeEventListener are made with similar but not identical arguments, and an event is dispatched. // The monitor should receive handleEvent calls. specify('EventListener is registered, other listeners (similar but not identical) are removed', () => { var monitor = new EventMonitor(); var other = {handleEvent: function(){}} this.doc.addEventListener("foo", monitor.handleEvent, false); this.doc.removeEventListener("foo", monitor.handleEvent, true); this.doc.removeEventListener("food", monitor.handleEvent, false); this.doc.removeEventListener("foo", other.handleEvent, false); var event = this.doc.createEvent("Events"); event.initEvent("foo",true,false); this.doc.dispatchEvent(event); assert.equal(monitor.allEvents.length, 1, 'should still receive the handleEvent call'); }); // Two listeners are registered on the same target, each of which will remove both itself and the other on the first event. Only one should see the event since event listeners can never be invoked after being removed. specify('two EventListeners which both handle by unregistering itself and the other', () => { // setup var es = []; var ls = []; var EventListener1 = function() { ls.push(this); } var EventListener2 = function() { ls.push(this); } EventListener1.prototype.handleEvent = function(event) { _handleEvent(event); } EventListener2.prototype.handleEvent = function(event) { _handleEvent(event); } var _handleEvent = function(event) { es.push(event); ls.forEach(function(l){ event.currentTarget.removeEventListener("foo", l.handleEvent, false); }) } // test var listener1 = new EventListener1(); var listener2 = new EventListener2(); this.doc.addEventListener("foo", listener1.handleEvent, false); this.doc.addEventListener("foo", listener2.handleEvent, false); var event = this.doc.createEvent("Events"); event.initEvent("foo",true,false); this.doc.dispatchEvent(event); assert.equal(es.length, 1, 'should only be handled by one EventListener'); }); }) // The Event.initEvent method is called for event returned by DocumentEvent.createEvent("Events") // The state is checked to see if it reflects the parameters. // @author Curt Arnold // @see http://www.w3.org/TR/DOM-Level-2-Events/events#Events-Event-initEvent describe('init event', () => { beforeEach(() => { var doc = require('../level1/core/files/hc_staff.xml').hc_staff(); this._events = ['Events'].map(function(t){ return(doc.createEvent(t)); }) }); afterEach(() => { _tearDown.call(this, '_events'); }); specify('set state from params, bubble no cancel', () => { this._events.forEach(function(event){ assert.notEqual(event, null, 'event should not be null for ' + event.eventType); event.initEvent('rotate', true, false); assert.equal(event.type, 'rotate', 'event type should be \"rotate\" for ' + event.eventType); assert.equal(event.bubbles, true, 'event should bubble for ' + event.eventType); assert.equal(event.cancelable, false, 'event should not be cancelable for ' + event.eventType); }) }); specify('set state from params, cancel no bubble', () => { this._events.forEach(function(event){ assert.notEqual(event, null, 'event should not be null for' + event.eventType); event.initEvent('rotate', false, true); assert.equal(event.type, 'rotate', 'event type should be \"rotate\" for ' + event.eventType); assert.equal(event.bubbles, false, 'event should not bubble for ' + event.eventType); assert.equal(event.cancelable, true, 'event should be cancelable for ' + event.eventType); }) }); specify('initEvent called multiple times, final time is definitive', () => { this._events.forEach(function(event){ assert.notEqual(event, null, 'event should not be null for ' + event.eventType); // rotate event.initEvent("rotate", true, true); assert.equal(event.type, 'rotate', 'event type should be \"rotate\" for ' + event.eventType); assert.equal(event.bubbles, true, 'event should bubble for ' + event.eventType); assert.equal(event.cancelable, true, 'event should be cancelable for ' + event.eventType); // shear event.initEvent("shear", false, false); assert.equal(event.type, 'shear', 'event type should be \"shear\" for ' + event.eventType); assert.equal(event.bubbles, false, 'event should not bubble for ' + event.eventType); assert.equal(event.cancelable, false, 'event should not be cancelable for ' + event.eventType); }) }); }) describe('capture event', () => { beforeEach(() => { _setUp.call(this); this.event.initEvent("foo",true,false); }); afterEach(() => { _tearDown.call(this); }); specify('all capturing listeners in a direct line from dispatched node will receive the event', () => { this.plist.addEventListener("foo", this.monitor.handleEvent, true); this.plist.firstChild.addEventListener("foo", this.monitor.handleEvent, false); this.plist.firstChild.dispatchEvent(this.event); assert.equal(this.monitor.atEvents.length, 1, 'should be at 1 event'); assert.equal(this.monitor.bubbledEvents.length, 0, 'should not have any bubbled events'); assert.equal(this.monitor.capturedEvents.length, 1, 'should have captured 1 event'); }); specify('only capture listeners in a direct line from target to the document node should receive the event', () => { var self = this; this.title.addEventListener("foo", this.monitor.handleEvent, true); this.plist.addEventListener("foo", function(event) { event.preventDefault(); self.monitor.handleEvent(event) }, false); this.plist.firstChild.addEventListener("foo", this.monitor.handleEvent, false); var return_val = this.plist.firstChild.dispatchEvent(this.event); assert.equal(return_val, true, 'dispatchEvent should return *true*'); assert.equal(this.monitor.atEvents.length, 1, 'should be at 1 event'); assert.equal(this.monitor.bubbledEvents.length, 1, 'should have bubbled 1 event'); assert.equal(this.monitor.capturedEvents.length, 0, 'should not have captured any events'); }); }) describe('bubble event', () => { beforeEach(() => { _setUp.call(this); this.event.initEvent("foo",true,false); }); afterEach(() => { _tearDown.call(this); }); specify('all non-capturing listeners in a direct line from dispatched node will receive a bubbling event', () => { this.win.addEventListener("foo", this.monitor.handleEvent, false); this.plist.addEventListener("foo", this.monitor.handleEvent, false); this.plist.firstChild.addEventListener("foo", this.monitor.handleEvent, false); this.plist.firstChild.dispatchEvent(this.event); assert.equal(this.monitor.atEvents.length, 1, 'should be at 1 event'); assert.equal(this.monitor.bubbledEvents.length, 2, 'should have 2 bubbled events'); assert.equal(this.monitor.capturedEvents.length, 0, 'should not have any captured events'); }); specify('only bubble listeners in a direct line from target to the document node should receive the event', () => { this.win.addEventListener("foo", this.monitor.handleEvent, false); this.title.addEventListener("foo", this.monitor.handleEvent, false); this.plist.addEventListener("foo", this._handleEvent('preventDefault'), true); this.plist.firstChild.addEventListener("foo", this.monitor.handleEvent, false); var return_val = this.plist.firstChild.dispatchEvent(this.event); assert.equal(return_val, true, 'dispatchEvent should return *true*'); assert.equal(this.monitor.atEvents.length, 1, 'should be at 1 event'); assert.equal(this.monitor.bubbledEvents.length, 1, 'should have 1 bubbled event'); assert.equal(this.monitor.capturedEvents.length, 1, 'should have captured 1 event'); }); specify('if an event does not bubble, bubble listeners should not receive the event', () => { this.win.addEventListener("foo", this.monitor.handleEvent, false); this.body.addEventListener("foo", this.monitor.handleEvent, true); this.plist.addEventListener("foo", this._handleEvent('preventDefault'), false); this.plist.firstChild.addEventListener("foo", this.monitor.handleEvent, false); this.event.initEvent("foo",false,false); var return_val = this.plist.firstChild.dispatchEvent(this.event); assert.equal(return_val, true, 'dispatchEvent should return *true*'); assert.equal(this.monitor.atEvents.length, 1, 'should be at 1 event'); assert.equal(this.monitor.bubbledEvents.length, 0, 'should not have any bubbled events'); assert.equal(this.monitor.capturedEvents.length, 1, 'should have captured 1 event'); }); }) describe('stop propagation', () => { beforeEach(() => { _setUp.call(this); this.event.initEvent("foo",true,false); }); afterEach(() => { _tearDown.call(this); }); specify('should prevent the target from receiving the event', () => { this.win.addEventListener("foo", this.monitor.handleEvent, false); this.plist.addEventListener("foo", this._handleEvent('stopPropagation'), true); this.plist.firstChild.addEventListener("foo", this.monitor.handleEvent, false); this.plist.firstChild.dispatchEvent(this.event); assert.equal(this.monitor.atEvents.length, 0, 'should be at 0 events'); assert.equal(this.monitor.bubbledEvents.length, 0, 'should have no bubbled events'); assert.equal(this.monitor.capturedEvents.length, 1, 'should have 1 captured event'); }); specify('should prevent all listeners from receiving the event', () => { this.win.addEventListener("foo", this.monitor.handleEvent, false); this.body.addEventListener("foo", this.monitor.handleEvent, false); this.plist.addEventListener("foo", this._handleEvent('stopPropagation'), false); this.plist.firstChild.addEventListener("foo", this.monitor.handleEvent, false); this.plist.firstChild.dispatchEvent(this.event); assert.equal(this.monitor.atEvents.length, 1, 'should be at 1 event'); assert.equal(this.monitor.bubbledEvents.length, 1, 'should have 1 bubbled event'); assert.equal(this.monitor.capturedEvents.length, 0, 'should have no captured events'); }); specify('stopPropagation should not prevent listeners on the same element from receiving the event', () => { this.win.addEventListener("foo", this.monitor.handleEvent, false); this.body.addEventListener("foo", this.monitor.handleEvent, false); this.plist.addEventListener("foo", this._handleEvent('stopPropagation'), true); this.plist.addEventListener("foo", this._handleEvent('stopPropagation'), false); this.plist.addEventListener("foo", this.monitor.handleEvent, true); this.plist.addEventListener("foo", this.monitor.handleEvent, false); this.plist.dispatchEvent(this.event); assert.equal(this.monitor.atEvents.length, 2, 'should be at 2 events'); // Changed from 4 to 2 after https://github.com/whatwg/dom/commit/98564fc5284439d2555f545fa04288e230a37a03 assert.equal(this.monitor.bubbledEvents.length, 0, 'should have no bubbled events'); assert.equal(this.monitor.capturedEvents.length, 0, 'should have no captured events'); }); }) describe('prevent default', () => { beforeEach(() => { _setUp.call(this); this.event.initEvent("foo",true,true); }); afterEach(() => { _tearDown.call(this); }); specify('the defaultPrevented flag is set when the event is prevented', () => { this.title.addEventListener("foo", function(event) { event.preventDefault();}, false); var return_val = this.title.dispatchEvent(this.event); assert.equal(this.event.defaultPrevented, true, 'the defaultPrevented flag should be true when the event is prevented'); }); specify('the defaultPrevented flag is not set when the event is not prevented', () => { this.title.addEventListener("foo", this.monitor.handleEvent, false); var return_val = this.title.dispatchEvent(this.event); assert.equal(this.event.defaultPrevented, false, 'the defaultPrevented flag should be false when the event is not prevented'); }); specify('a cancelable event can have its default event disabled', () => { this.body.addEventListener("foo", this.monitor.handleEvent, true); this.plist.addEventListener("foo", this._handleEvent('preventDefault'), false); this.plist.firstChild.addEventListener("foo", this.monitor.handleEvent, false); var return_val = this.plist.firstChild.dispatchEvent(this.event); assert.equal(return_val, false, 'dispatchEvent should return *false*'); assert.equal(this.monitor.atEvents.length, 1, 'should be at 1 event'); assert.equal(this.monitor.bubbledEvents.length, 1, 'should have bubbled 1 event'); assert.equal(this.monitor.capturedEvents.length, 1, 'should have captured 1 event'); }); specify('a non-cancelable event cannot have its default event disabled', () => { this.body.addEventListener("foo", this.monitor.handleEvent, true); this.plist.addEventListener("foo", this._handleEvent('preventDefault'), false); this.plist.firstChild.addEventListener("foo", this.monitor.handleEvent, false); this.event.initEvent("foo",true,false); var return_val = this.plist.firstChild.dispatchEvent(this.event); assert.equal(return_val, true, 'dispatchEvent should return *true*'); assert.equal(this.monitor.atEvents.length, 1, 'should be at 1 event'); assert.equal(this.monitor.bubbledEvents.length, 1, 'should have bubbled 1 event'); assert.equal(this.monitor.capturedEvents.length, 1, 'should have captured 1 event'); }); }); specify('remove listener in handler', () => { const { document } = (new JSDOM()).window; let h1 = 0, h2 = 0; document.addEventListener("click", function handler1() { // Event handler that removes itself h1++; document.removeEventListener("click", handler1); }); document.addEventListener("click", () => h2++); const ev = document.createEvent("MouseEvents"); ev.initEvent("click", true, true); document.dispatchEvent(ev); assert.strictEqual(h1, 1, "handler1 must be called once"); assert.strictEqual(h2, 1, "handler2 must be called once"); document.dispatchEvent(ev); assert.strictEqual(h1, 1, "handler1 must be called once"); assert.strictEqual(h2, 2, "handler2 must be called twice"); }); }); jsdom-19.0.0/test/to-port-to-wpts/level2/html.js000066400000000000000000020410501415223704400214120ustar00rootroot00000000000000const { assert } = require("chai"); const { describe, specify } = require("mocha-sugar-free"); const { JSDOM } = require("../../.."); const toPathname = require("../../util.js").toPathname(__dirname); const toFileUrl = require("../../util.js").toFileUrl(__dirname); const load = require("../../util.js").load(__dirname + "/html/"); function getImplementation() { return (new JSDOM()).window.document.implementation; } describe("level2/html", { skipIfBrowser: true }, () => { /** * The accessKey attribute is a single character access key to give access to the form control. Retrieve the accessKey attribute and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-89647724 */ specify("HTMLAnchorElement01", () => { var success; var nodeList; var testNode; var vaccesskey; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("anchor"); nodeList = doc.getElementsByTagName("a"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vaccesskey = testNode.accessKey; assert.equal(vaccesskey, "g", "accessKeyLink"); }); /** * The charset attribute indicates the character encoding of the linked resource. Retrieve the charset attribute and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-67619266 */ specify("HTMLAnchorElement02", () => { var success; var nodeList; var testNode; var vcharset; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("anchor"); nodeList = doc.getElementsByTagName("a"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vcharset = testNode.charset; assert.equal(vcharset, "US-ASCII", "charsetLink"); }); /** * The coords attribute is a comma-seperated list of lengths, defining an active region geometry. Retrieve the coords attribute and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-92079539 */ specify("HTMLAnchorElement03", () => { var success; var nodeList; var testNode; var vcoords; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("anchor"); nodeList = doc.getElementsByTagName("a"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vcoords = testNode.coords; assert.equal(vcoords, "0,0,100,100", "coordsLink"); }); /** * The href attribute contains the URL of the linked resource. Retrieve the href attribute and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-88517319 */ specify("HTMLAnchorElement04", () => { var doc = load("anchor"); var nodeList = doc.getElementsByTagName("a"); assert.equal(nodeList.length, 1, 'Asize'); assert.equal(nodeList.item(0).href, toFileUrl('html/files/pix/submit.gif'), 'hrefLink'); }); /** * The hreflang attribute contains the language code of the linked resource. Retrieve the hreflang attribute and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-87358513 */ specify("HTMLAnchorElement05", () => { var success; var nodeList; var testNode; var vhreflink; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("anchor"); nodeList = doc.getElementsByTagName("a"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vhreflink = testNode.hreflang; assert.equal(vhreflink, "en", "hreflangLink"); }); /** * The name attribute contains the anchor name. Retrieve the name attribute and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-32783304 */ specify("HTMLAnchorElement06", () => { var success; var nodeList; var testNode; var vname; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("anchor"); nodeList = doc.getElementsByTagName("a"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vname = testNode.name; assert.equal(vname, "Anchor", "nameLink"); }); /** * The rel attribute contains the forward link type. Retrieve the rel attribute and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-3815891 */ specify("HTMLAnchorElement07", () => { var success; var nodeList; var testNode; var vrel; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("anchor"); nodeList = doc.getElementsByTagName("a"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vrel = testNode.rel; assert.equal(vrel, "GLOSSARY", "relLink"); }); /** * The rev attribute contains the reverse link type Retrieve the rev attribute and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-58259771 */ specify("HTMLAnchorElement08", () => { var success; var nodeList; var testNode; var vrev; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("anchor"); nodeList = doc.getElementsByTagName("a"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vrev = testNode.rev; assert.equal(vrev, "STYLESHEET", "revLink"); }); /** * The shape attribute contains the shape of the active area. Retrieve the shape attribute and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-49899808 */ specify("HTMLAnchorElement09", () => { var success; var nodeList; var testNode; var vshape; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("anchor"); nodeList = doc.getElementsByTagName("a"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vshape = testNode.shape; assert.equal(vshape, "rect", "shapeLink"); }); /** * The tabIndex attribute contains an index that represents the elements position in the tabbing order. Retrieve the tabIndex attribute and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-41586466 */ specify("HTMLAnchorElement10", () => { var success; var nodeList; var testNode; var vtabindex; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("anchor"); nodeList = doc.getElementsByTagName("a"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vtabindex = testNode.tabIndex; assert.equal(vtabindex, 22, "tabIndexLink"); }); /** * The target attribute specifies the frame to render the source in. Retrieve the target attribute and examine it's value. * @author NIST * @author Rick Rivello * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-6414197 */ specify("HTMLAnchorElement11", () => { var success; var nodeList; var testNode; var vtarget; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("anchor2"); nodeList = doc.getElementsByTagName("a"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vtarget = testNode.target; assert.equal(vtarget, "dynamic", "targetLink"); }); /** * The type attribute contains the advisory content model. Retrieve the type attribute and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-63938221 */ specify("HTMLAnchorElement12", () => { var success; var nodeList; var testNode; var vtype; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("anchor"); nodeList = doc.getElementsByTagName("a"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vtype = testNode.type; assert.equal(vtype, "image/gif", "typeLink"); }); /** * HTMLAnchorElement.blur should surrender input focus. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-65068939 */ specify("HTMLAnchorElement13", () => { var success; var nodeList; var testNode; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("anchor"); nodeList = doc.getElementsByTagName("a"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); testNode.blur(); }); /** * HTMLAnchorElement.focus should capture input focus. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-47150313 */ specify("HTMLAnchorElement14", () => { var success; var nodeList; var testNode; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("anchor"); nodeList = doc.getElementsByTagName("a"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); testNode.focus(); }); /** * HTMLAnchorElement.hostname should show the hostname of the href when relative * @author Avi Deitcher * @see https://developer.mozilla.org/en/DOM/HTMLAnchorElement */ specify("HTMLAnchorElement15", () => { var doc = load("anchor2"); var nodeList = doc.getElementsByTagName("a"); assert.equal(nodeList.length, 1, 'Asize'); assert.equal(nodeList.item(0).hostname, '', 'a.hostname relative'); }); /** * HTMLAnchorElement.hostname should show the hostname of the href when absolute * @author Avi Deitcher * @see https://developer.mozilla.org/en/DOM/HTMLAnchorElement */ specify("HTMLAnchorElement16", () => { var doc = load("anchor3"); var nodeList = doc.getElementsByTagName("a"); assert.equal(nodeList.length, 1, 'Asize'); assert.equal(nodeList.item(0).hostname, 'www.github.com', 'a.hostname absolute'); }); /** * HTMLAnchorElement.pathname should show the pathname of the href * @author Avi Deitcher * @see https://developer.mozilla.org/en/DOM/HTMLAnchorElement */ specify("HTMLAnchorElement17", () => { var doc = load("anchor2"); var nodeList = doc.getElementsByTagName("a"); assert.equal(nodeList.length, 1, 'Asize'); assert.equal(nodeList.item(0).pathname, toPathname('html/files/pix/submit.gif'), 'a.pathname relative with ./'); }); /** * HTMLAnchorElement.pathname should show the pathname of the href * @author Avi Deitcher * @see https://developer.mozilla.org/en/DOM/HTMLAnchorElement */ specify("HTMLAnchorElement18", () => { var doc = load("anchor3"); var nodeList = doc.getElementsByTagName("a"); assert.equal(nodeList.length, 1, 'Asize'); assert.equal(nodeList.item(0).pathname, '/jsdom/jsdom', 'a.pathname absolute'); }); /** * * HTMLAnchorElement.host should show the host and port if port is not default * @author Salvatore Porchia * @see https://developer.mozilla.org/en/DOM/HTMLAnchorElement */ specify("HTMLAnchorElement19", () => { var doc = load("anchor3"); var nodeList = doc.getElementsByTagName("a"); assert.equal(nodeList.length, 1, 'Asize'); assert.equal(nodeList.item(0).host, 'www.github.com', 'a.host'); var doc = load("anchor4"); var nodeList = doc.getElementsByTagName("a"); assert.equal(nodeList.length, 1, 'Asize'); assert.equal(nodeList.item(0).host, 'www.github.com:3020', 'a.host'); }); /** * HTMLAnchorElement.hash should show part of url after hash * @author Peter Culak * @see https://developer.mozilla.org/en/DOM/HTMLAnchorElement */ specify("HTMLAnchorElement20", () => { var doc = load("anchor5"); var nodeList = doc.getElementsByTagName("a"); assert.equal(nodeList.length, 1, 'Asize'); assert.equal(nodeList.item(0).host, 'www.github.com:3020', 'a.host'); assert.equal(nodeList.item(0).hash, '#fragment-identifier', 'a.hash'); }); /** * * HTMLAnchorElement.port should show the port if port is not default * @author Salvatore Porchia * @see https://developer.mozilla.org/en/DOM/HTMLAnchorElement */ specify("HTMLAnchorElement21", () => { var doc = load("anchor3"); var nodeList = doc.getElementsByTagName("a"); assert.equal(nodeList.length, 1, 'Asize'); assert.equal(nodeList.item(0).port, '', 'a.port'); var doc = load("anchor4"); var nodeList = doc.getElementsByTagName("a"); assert.equal(nodeList.length, 1, 'Asize'); assert.equal(nodeList.item(0).port, '3020', 'a.port'); }); /** * * HTMLAnchorElement.protocol should show the protocol including trailing ':'. * @author Salvatore Porchia * @see https://developer.mozilla.org/en/DOM/HTMLAnchorElement */ specify("HTMLAnchorElement22", () => { var doc = load("anchorEmpty"); var nodeList = doc.getElementsByTagName("a"); assert.equal(nodeList.length, 1, 'Asize'); // Firefox shows 'http:' Chrome/Safari show ':' on empty href. assert.equal(nodeList.item(0).protocol, ':', 'a.protocol'); var doc = load("anchor2"); var nodeList = doc.getElementsByTagName("a"); assert.equal(nodeList.length, 1, 'Asize'); assert.equal(nodeList.item(0).protocol, 'file:', 'a.protocol'); var doc = load("anchor3"); var nodeList = doc.getElementsByTagName("a"); assert.equal(nodeList.length, 1, 'Asize'); assert.equal(nodeList.item(0).protocol, 'https:', 'a.protocol'); var doc = load("anchor4"); var nodeList = doc.getElementsByTagName("a"); assert.equal(nodeList.length, 1, 'Asize'); assert.equal(nodeList.item(0).protocol, 'http:', 'a.protocol'); var doc = load("anchor6"); var nodeList = doc.getElementsByTagName("a"); assert.equal(nodeList.length, 1, 'Asize'); assert.equal(nodeList.item(0).protocol, 'special:', 'a.protocol'); }); /** * HTMLAnchorElement.href should show the pathname of the href * @author eleith */ specify("HTMLAnchorElement23", () => { var doc = load("anchorEmpty"); var nodeList = doc.getElementsByTagName("a"); assert.equal(nodeList.length, 1, 'A size'); assert.equal(nodeList.item(0).href, '', 'A.href is empty'); }); /** * * HTMLAnchorElement.pathname should be the empty string when path is empty * @author Adam Faulkner * @see http://url.spec.whatwg.org/#dom-url-pathname */ specify("HTMLAnchorElement24", () => { var doc = load("anchorEmpty"); var nodeList = doc.getElementsByTagName("a"); assert.equal(nodeList.length, 1, 'A size'); assert.equal(nodeList.item(0).pathname, '', 'A.pathname is empty'); }); /** * * HTMLAnchorElement.username * @author Salvatore Porchia * @see http://url.spec.whatwg.org/#dom-url-username */ specify("HTMLAnchorElement25", () => { var doc = load("anchor7"); var nodeList = doc.getElementsByTagName("a"); assert.equal(nodeList.length, 1, 'A size'); assert.equal(nodeList.item(0).username, 'user', 'A.username'); }); /** * * HTMLAnchorElement.password * @author Salvatore Porchia * @see http://url.spec.whatwg.org/#dom-url-password */ specify("HTMLAnchorElement26", () => { var doc = load("anchor7"); var nodeList = doc.getElementsByTagName("a"); assert.equal(nodeList.length, 1, 'A size'); assert.equal(nodeList.item(0).password, 'pa%3Ass', 'A.password'); }); /** * * HTMLAnchorElement.origin * @author Salvatore Porchia * @see http://url.spec.whatwg.org/#dom-url-origin */ specify("HTMLAnchorElement27", () => { var doc = load("anchorEmpty"); var nodeList = doc.getElementsByTagName("a"); assert.equal(nodeList.length, 1, 'A size'); assert.equal(nodeList.item(0).origin, '', 'a.origin'); var doc = load("anchor2"); var nodeList = doc.getElementsByTagName("a"); assert.equal(nodeList.length, 1, 'A size'); assert.equal(nodeList.item(0).origin, 'null', 'a.origin'); var doc = load("anchor3"); var nodeList = doc.getElementsByTagName("a"); assert.equal(nodeList.length, 1, 'A size'); assert.equal(nodeList.item(0).origin, 'https://www.github.com', 'a.origin'); var doc = load("anchor4"); var nodeList = doc.getElementsByTagName("a"); assert.equal(nodeList.length, 1, 'A size'); assert.equal(nodeList.item(0).origin, 'http://www.github.com:3020', 'a.origin'); var doc = load("anchor7"); var nodeList = doc.getElementsByTagName("a"); assert.equal(nodeList.length, 1, 'A size'); assert.equal(nodeList.item(0).origin, 'http://www.github.com:500', 'a.origin'); }); /** * * HTMLAnchorElement.search * @author Salvatore Porchia * @see http://url.spec.whatwg.org/#dom-url-search */ specify("HTMLAnchorElement28", () => { var doc = load("anchor6"); var nodeList = doc.getElementsByTagName("a"); assert.equal(nodeList.length, 1, 'A size'); assert.equal(nodeList.item(0).search, '', 'a.search'); var doc = load("anchor7"); var nodeList = doc.getElementsByTagName("a"); assert.equal(nodeList.length, 1, 'A size'); assert.equal(nodeList.item(0).search, '?testing=tested', 'A.search'); }); /** * The accessKey attribute specifies a single character access key to give access to the control form. Retrieve the accessKey attribute and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-57944457 */ specify("HTMLAreaElement01", () => { var success; var nodeList; var testNode; var vaccesskey; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("area"); nodeList = doc.getElementsByTagName("area"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vaccesskey = testNode.accessKey; assert.equal(vaccesskey, "a", "alignLink"); }); /** * The alt attribute specifies an alternate text for user agents not rendering the normal content of this element. Retrieve the alt attribute and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-39775416 */ specify("HTMLAreaElement02", () => { var success; var nodeList; var testNode; var valt; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("area"); nodeList = doc.getElementsByTagName("area"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); valt = testNode.alt; assert.equal(valt, "Domain", "altLink"); }); /** * The coords attribute specifies a comma-seperated list of lengths, defining an active region geometry. Retrieve the coords attribute and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-66021476 */ specify("HTMLAreaElement03", () => { var success; var nodeList; var testNode; var vcoords; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("area"); nodeList = doc.getElementsByTagName("area"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vcoords = testNode.coords; assert.equal(vcoords, "0,2,45,45", "coordsLink"); }); /** * The href attribute specifies the URI of the linked resource. Retrieve the href attribute and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-34672936 */ specify("HTMLAreaElement04", () => { var doc = load("area"); var nodeList = doc.getElementsByTagName("area"); assert.equal(nodeList.length, 1, 'Asize'); assert.equal(nodeList.item(0).href, toFileUrl('html/files/files/dletter.html'), 'hrefLink'); }); /** * The noHref attribute specifies that this area is inactive. Retrieve the noHref attribute and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-61826871 */ specify("HTMLAreaElement05", () => { var success; var nodeList; var testNode; var vnohref; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("area"); nodeList = doc.getElementsByTagName("area"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vnohref = testNode.noHref; assert.equal(vnohref, false, 'vnohref should be *false*'); }); /** * The shape attribute specifies the shape of the active area. Retrieve the shape attribute and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-85683271 */ specify("HTMLAreaElement06", () => { var success; var nodeList; var testNode; var vshape; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("area"); nodeList = doc.getElementsByTagName("area"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vshape = testNode.shape; assert.equal(vshape.toLowerCase(), "rect".toLowerCase(), "shapeLink"); }); /** * The tabIndex attribute specifies an index that represents the element's position in the tabbing order. Retrieve the tabIndex attribute and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-8722121 */ specify("HTMLAreaElement07", () => { var success; var nodeList; var testNode; var vtabindex; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("area"); nodeList = doc.getElementsByTagName("area"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vtabindex = testNode.tabIndex; assert.equal(vtabindex, 10, "tabIndexLink"); }); /** * The target specifies the frame to render the resource in. Retrieve the target attribute and examine it's value. * @author NIST * @author Rick Rivello * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-46054682 */ specify("HTMLAreaElement08", () => { var success; var nodeList; var testNode; var vtarget; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("area2"); nodeList = doc.getElementsByTagName("area"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vtarget = testNode.target; assert.equal(vtarget, "dynamic", "targetLink"); }); /** * The clear attribute specifies control flow of text around floats. Retrieve the clear attribute and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-82703081 */ specify("HTMLBRElement01", () => { var success; var nodeList; var testNode; var vclear; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("br"); nodeList = doc.getElementsByTagName("br"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vclear = testNode.clear; assert.equal(vclear, "none", "clearLink"); }); /** * The href attribute specifies the base URI. Retrieve the href attribute and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-65382887 */ specify("HTMLBaseElement01", () => { var success; var nodeList; var testNode; var vhref; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("base"); nodeList = doc.getElementsByTagName("base"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vhref = testNode.href; assert.equal(vhref, "about:blank", "hrefLink"); }); /** * The target attribute specifies the default target frame. Retrieve the target attribute and examine its value. * @author NIST * @author Rick Rivello * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-73844298 */ specify("HTMLBaseElement02", () => { var success; var nodeList; var testNode; var vtarget; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("base2"); nodeList = doc.getElementsByTagName("base"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vtarget = testNode.target; assert.equal(vtarget, "Frame1", "targetLink"); }); /** * The aLink attribute specifies the color of active links. Retrieve the aLink attribute and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-59424581 */ specify("HTMLBodyElement01", () => { var success; var nodeList; var testNode; var valink; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("body"); nodeList = doc.getElementsByTagName("body"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); valink = testNode.aLink; assert.equal(valink, "#0000ff", "aLinkLink"); }); /** * The background attribute specifies the URI fo the background texture tile image. Retrieve the background attribute and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-37574810 */ specify("HTMLBodyElement02", () => { var success; var nodeList; var testNode; var vbackground; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("body"); nodeList = doc.getElementsByTagName("body"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vbackground = testNode.background; assert.equal(vbackground, "./pix/back1.gif", "backgroundLink"); }); /** * The bgColor attribute specifies the document background color. Retrieve the bgColor attribute and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-24940084 */ specify("HTMLBodyElement03", () => { var success; var nodeList; var testNode; var vbgcolor; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("body"); nodeList = doc.getElementsByTagName("body"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vbgcolor = testNode.bgColor; assert.equal(vbgcolor, "#ffff00", "bgColorLink"); }); /** * The link attribute specifies the color of links that are not active and unvisited. Retrieve the link attribute and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-7662206 */ specify("HTMLBodyElement04", () => { var success; var nodeList; var testNode; var vlink; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("body"); nodeList = doc.getElementsByTagName("body"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vlink = testNode.link; assert.equal(vlink, "#ff0000", "linkLink"); }); /** * The text attribute specifies the document text color. Retrieve the text attribute and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-73714763 */ specify("HTMLBodyElement05", () => { var success; var nodeList; var testNode; var vtext; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("body"); nodeList = doc.getElementsByTagName("body"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vtext = testNode.text; assert.equal(vtext, "#000000", "textLink"); }); /** * The vLink attribute specifies the color of links that have been visited by the user. Retrieve the vLink attribute and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-83224305 */ specify("HTMLBodyElement06", () => { var success; var nodeList; var testNode; var vvlink; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("body"); nodeList = doc.getElementsByTagName("body"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vvlink = testNode.vLink; assert.equal(vvlink, "#00ffff", "vLinkLink"); }); /** * The form attribute returns the FORM element containing this control. Retrieve the form attribute and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-71254493 */ specify("HTMLButtonElement01", () => { var success; var nodeList; var testNode; var fNode; var vform; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("button"); nodeList = doc.getElementsByTagName("button"); assert.equal(nodeList.length, 2, 'Asize'); testNode = nodeList.item(0); fNode = testNode.form; vform = fNode.id; assert.equal(vform, "form2", "formLink"); }); /** * The form attribute returns null if control in not within the context of form. Retrieve the form attribute and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-71254493 */ specify("HTMLButtonElement02", () => { var success; var nodeList; var testNode; var vform; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("button"); nodeList = doc.getElementsByTagName("button"); assert.equal(nodeList.length, 2, 'Asize'); testNode = nodeList.item(1); vform = testNode.form; assert.equal(vform, null, 'vform should be null'); }); /** * The accessKey attribute returns a single character access key to give access to the form control. Retrieve the accessKey attribute and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-73169431 */ specify("HTMLButtonElement03", () => { var success; var nodeList; var testNode; var vaccesskey; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("button"); nodeList = doc.getElementsByTagName("button"); assert.equal(nodeList.length, 2, 'Asize'); testNode = nodeList.item(0); vaccesskey = testNode.accessKey; assert.equal(vaccesskey, "f", "accessKeyLink"); }); /** * The disabled attribute specifies whether the control is unavailable in this context. Retrieve the disabled attribute and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-92757155 */ specify("HTMLButtonElement04", () => { var success; var nodeList; var testNode; var vdisabled; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("button"); nodeList = doc.getElementsByTagName("button"); assert.equal(nodeList.length, 2, 'Asize'); testNode = nodeList.item(0); vdisabled = testNode.disabled; assert.ok(vdisabled, 'disabledLink'); }); /** * The name attribute is the form control or object name when submitted with a form. Retrieve the name attribute and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-11029910 */ specify("HTMLButtonElement05", () => { var success; var nodeList; var testNode; var vname; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("button"); nodeList = doc.getElementsByTagName("button"); assert.equal(nodeList.length, 2, 'Asize'); testNode = nodeList.item(0); vname = testNode.name; assert.equal(vname, "disabledButton", "nameLink"); }); /** * The tabIndex attribute specifies an index that represents the element's position in the tabbing order. Retrieve the tabIndex attribute and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-39190908 */ specify("HTMLButtonElement06", () => { var success; var nodeList; var testNode; var vtabindex; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("button"); nodeList = doc.getElementsByTagName("button"); assert.equal(nodeList.length, 2, 'Asize'); testNode = nodeList.item(0); vtabindex = testNode.tabIndex; assert.equal(vtabindex, 20, "tabIndexLink"); }); /** * The type attribute specifies the type of button. Retrieve the type attribute and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-27430092 */ specify("HTMLButtonElement07", () => { var success; var nodeList; var testNode; var vtype; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("button"); nodeList = doc.getElementsByTagName("button"); assert.equal(nodeList.length, 2, 'Asize'); testNode = nodeList.item(0); vtype = testNode.type; assert.equal(vtype, "reset", "typeLink"); }); /** * The value attribute specifies the current control value. Retrieve the value attribute and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-72856782 */ specify("HTMLButtonElement08", () => { var success; var nodeList; var testNode; var vvalue; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("button"); nodeList = doc.getElementsByTagName("button"); assert.equal(nodeList.length, 2, 'Asize'); testNode = nodeList.item(0); vvalue = testNode.value; assert.equal(vvalue, "Reset Disabled Button", "valueLink"); }); /** * An individual node may be accessed by either ordinal index, the node's name or id attributes. (Test ordinal index). Retrieve the first TABLE element and create a HTMLCollection by invoking the "rows" attribute. The item located at ordinal index 0 is further retrieved and its "rowIndex" attribute is examined. * @author NIST * @author Rick Rivello * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-33262535 */ specify("HTMLCollection01", () => { var success; var nodeList; var testNode; var rowNode; var rowsnodeList; var vrowindex; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("collection"); nodeList = doc.getElementsByTagName("table"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); rowsnodeList = testNode.rows; rowNode = rowsnodeList.item(0); vrowindex = rowNode.rowIndex; assert.equal(vrowindex, 0, "rowIndexLink"); }); /** * An individual node may be accessed by either ordinal index, the node's name or id attributes. (Test node name). Retrieve the first FORM element and create a HTMLCollection by invoking the elements attribute. The first SELECT element is further retrieved using the elements name attribute. * @author NIST * @author Rick Rivello * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-76728479 */ specify("HTMLCollection02", () => { var success; var nodeList; var testNode; var formNode; var formsnodeList; var vname; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("collection"); nodeList = doc.getElementsByTagName("form"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); formsnodeList = testNode.elements; formNode = formsnodeList.namedItem("select1"); vname = formNode.nodeName; assert.equal(vname, 'SELECT', 'nameIndexLink'); }); /** * An individual node may be accessed by either ordinal index, the node's name or id attributes. (Test id attribute). Retrieve the first FORM element and create a HTMLCollection by invoking the "element" attribute. The first SELECT element is further retrieved using the elements id. * @author NIST * @author Rick Rivello * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-21069976 */ specify("HTMLCollection03", () => { var success; var nodeList; var testNode; var formNode; var formsnodeList; var vname; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("collection"); nodeList = doc.getElementsByTagName("form"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); formsnodeList = testNode.elements; formNode = formsnodeList.namedItem("selectId"); vname = formNode.nodeName; assert.equal(vname, 'SELECT', 'nameIndexLink'); }); /** * HTMLCollections are live, they are automatically updated when the underlying document is changed. Create a HTMLCollection object by invoking the rows attribute of the first TABLE element and examine its length, then add a new row and re-examine the length. * @author NIST * @author Rick Rivello * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-40057551 */ specify("HTMLCollection04", () => { var success; var nodeList; var testNode; var rowLength1; var rowLength2; var rowsnodeList; var newRow; var vrowindex; var doc; var result = new Array(); expectedResult = new Array(); expectedResult[0] = 4; expectedResult[1] = 5; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("collection"); nodeList = doc.getElementsByTagName("table"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); rowsnodeList = testNode.rows; rowLength1 = rowsnodeList.length; result[result.length] = rowLength1; newRow = testNode.insertRow(4); rowLength2 = rowsnodeList.length; result[result.length] = rowLength2; assert.deepEqual(result, expectedResult, 'rowIndexLink'); }); /** * The length attribute specifies the length or size of the list. Retrieve the first TABLE element and create a HTMLCollection by invoking the "rows" attribute. Retrieve the length attribute of the HTMLCollection object. * @author NIST * @author Rick Rivello * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-40057551 */ specify("HTMLCollection05", () => { var success; var nodeList; var testNode; var rowsnodeList; var rowLength; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("collection"); nodeList = doc.getElementsByTagName("table"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); rowsnodeList = testNode.rows; rowLength = rowsnodeList.length; assert.equal(rowLength, 4, "rowIndexLink"); }); /** * An item(index) method retrieves an item specified by ordinal index (Test for index=0). Retrieve the first TABLE element and create a HTMLCollection by invoking the "rows" attribute. The item located at ordinal index 0 is further retrieved and its "rowIndex" attribute is examined. * @author NIST * @author Rick Rivello * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-6156016 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-33262535 */ specify("HTMLCollection06", () => { var success; var nodeList; var testNode; var rowNode; var rowsnodeList; var vrowindex; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("collection"); nodeList = doc.getElementsByTagName("table"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); rowsnodeList = testNode.rows; rowNode = rowsnodeList.item(0); vrowindex = rowNode.rowIndex; assert.equal(vrowindex, 0, "rowIndexLink"); }); /** * An item(index) method retrieves an item specified by ordinal index (Test for index=3). Retrieve the first TABLE element and create a HTMLCollection by invoking the "rows" attribute. The item located at ordinal index 3 is further retrieved and its "rowIndex" attribute is examined. * @author NIST * @author Rick Rivello * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-33262535 */ specify("HTMLCollection07", () => { var success; var nodeList; var testNode; var rowNode; var rowsnodeList; var vrowindex; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("collection"); nodeList = doc.getElementsByTagName("table"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); rowsnodeList = testNode.rows; rowNode = rowsnodeList.item(3); vrowindex = rowNode.rowIndex; assert.equal(vrowindex, 3, "rowIndexLink"); }); /** * Nodes in a HTMLCollection object are numbered in tree order. (Depth-first traversal order). Retrieve the first TABLE element and create a HTMLCollection by invoking the "rows" attribute. Access the item in the third ordinal index. The resulting rowIndex attribute is examined and should be two. * @author NIST * @author Rick Rivello * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-33262535 */ specify("HTMLCollection08", () => { var success; var nodeList; var testNode; var rowNode; var rowsnodeList; var vrowindex; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("collection"); nodeList = doc.getElementsByTagName("table"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); rowsnodeList = testNode.rows; rowNode = rowsnodeList.item(2); vrowindex = rowNode.rowIndex; assert.equal(vrowindex, 2, "rowIndexLink"); }); /** * The item(index) method returns null if the index is out of range. Retrieve the first TABLE element and create a HTMLCollection by invoking the "rows" attribute. Invoke the item(index) method with an index of 5. This index is out of range and should return null. * @author NIST * @author Rick Rivello * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-33262535 */ specify("HTMLCollection09", () => { var success; var nodeList; var testNode; var rowNode; var rowsnodeList; var vrowindex; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("collection"); nodeList = doc.getElementsByTagName("table"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); rowsnodeList = testNode.rows; rowNode = rowsnodeList.item(5); assert.equal(rowNode, null, 'rowNode should be null'); }); /** * The namedItem(name) method retrieves a node using a name. It first searches for a node with a matching id attribute. If it doesn't find one, it then searches for a Node with a matching name attribute, but only on those elements that are allowed a name attribute. Retrieve the first FORM element and create a HTMLCollection by invoking the elements attribute. The first SELECT element is further retrieved using the elements name attribute since the id attribute doesn't match. * @author NIST * @author Rick Rivello * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-21069976 */ specify("HTMLCollection10", () => { var success; var nodeList; var testNode; var formNode; var formsnodeList; var vname; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("collection"); nodeList = doc.getElementsByTagName("form"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); formsnodeList = testNode.elements; formNode = formsnodeList.namedItem("select1"); vname = formNode.nodeName; assert.equal(vname, 'SELECT', 'nameIndexLink'); }); /** * The namedItem(name) method retrieves a node using a name. It first searches for a node with a matching id attribute. If it doesn't find one, it then searches for a Node with a matching name attribute, but only on those elements that are allowed a name attribute. Retrieve the first FORM element and create a HTMLCollection by invoking the elements attribute. The first SELECT element is further retrieved using the elements id attribute. * @author NIST * @author Rick Rivello * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-76728479 */ specify("HTMLCollection11", () => { var success; var nodeList; var testNode; var formNode; var formsnodeList; var vname; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("collection"); nodeList = doc.getElementsByTagName("form"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); formsnodeList = testNode.elements; formNode = formsnodeList.namedItem("selectId"); vname = formNode.nodeName; assert.equal(vname, 'SELECT', 'nameIndexLink'); }); /** * The namedItem(name) method retrieves a node using a name. It first searches for a node with a matching id attribute. If it doesn't find one, it then searches for a Node with a matching name attribute, but only on those elements that are allowed a name attribute. If there isn't a matching node the method returns null. Retrieve the first FORM element and create a HTMLCollection by invoking the elements attribute. The method returns null since there is not a match of the name or id attribute. * @author NIST * @author Rick Rivello * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-21069976 */ specify("HTMLCollection12", () => { var success; var nodeList; var testNode; var formNode; var formsnodeList; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("collection"); nodeList = doc.getElementsByTagName("form"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); formsnodeList = testNode.elements; formNode = formsnodeList.namedItem("select9"); assert.equal(formNode, null, 'formNode should be null'); }); /** * The compact attribute specifies a boolean value on whether to display the list more compactly. Retrieve the compact attribute and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-75317739 */ specify("HTMLDirectoryElement01", () => { var success; var nodeList; var testNode; var vcompact; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("directory"); nodeList = doc.getElementsByTagName("dir"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vcompact = testNode.compact; assert.ok(vcompact, 'compactLink'); }); /** * The align attribute specifies the horizontal text alignment. Retrieve the align attribute and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-70908791 */ specify("HTMLDivElement01", () => { var success; var nodeList; var testNode; var valign; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("div"); nodeList = doc.getElementsByTagName("div"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); valign = testNode.align; assert.equal(valign, "center", "alignLink"); }); /** * The compact attribute specifies a boolean value on whether to display the list more compactly. Retrieve the compact attribute and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-21738539 */ specify("HTMLDlistElement01", () => { var success; var nodeList; var testNode; var vcompact; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("dl"); nodeList = doc.getElementsByTagName("dl"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vcompact = testNode.compact; assert.ok(vcompact, 'compactLink'); }); /** * The title attribute is the specified title as a string. Retrieve the title attribute and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-18446827 */ specify("HTMLDocument01", () => { var success; var nodeList; var vtitle; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("document"); vtitle = doc.title; assert.equal(vtitle, "NIST DOM HTML Test - DOCUMENT", "titleLink"); }); /** * The URL attribute specifies the absolute URI of the document. Retrieve the URL attribute and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-46183437 */ specify("HTMLDocument04", () => { var success; var nodeList; var testNode; var vurl; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("document"); vurl = doc.URL; assert.equal(vurl, toFileUrl('html/files/document.html'), 'URLLink'); }); /** * The body attribute is the element that contains the content for the document. Retrieve the body attribute and examine its value for the id attribute. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-56360201 */ specify("HTMLDocument05", () => { var success; var nodeList; var testNode; var vbody; var vid; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("document"); vbody = doc.body; vid = vbody.id; assert.equal(vid, "TEST-BODY", "idLink"); }); /** * The images attribute returns a collection of all IMG elements in a document. Retrieve the images attribute from the document and examine its value. * @author NIST * @author Rick Rivello * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-90379117 */ specify("HTMLDocument07", () => { var success; var nodeList; var testNode; var vimages; var vlength; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("document"); vimages = doc.images; vlength = vimages.length; assert.equal(vlength, 1, "lengthLink"); }); /** * The links attribute returns a collection of all AREA and A elements in a document with a value for the href attribute. Retrieve the links attribute from the document and examine its value. * @author NIST * @author Rick Rivello * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-7068919 */ specify("HTMLDocument09", () => { var success; var nodeList; var testNode; var vlinks; var vlength; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("document"); vlinks = doc.links; vlength = vlinks.length; assert.equal(vlength, 3, "lengthLink"); }); /** * The forms attribute returns a collection of all the forms in a document. Retrieve the forms attribute from the document and examine its value. * @author NIST * @author Rick Rivello * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-1689064 */ specify("HTMLDocument10", () => { var success; var nodeList; var testNode; var vforms; var vlength; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("document"); vforms = doc.forms; vlength = vforms.length; assert.equal(vlength, 1, "lengthLink"); }); /** * The anchors attribute returns a collection of all A elements with values for the name attribute. Retrieve the anchors attribute from the document and examine its value. * @author NIST * @author Rick Rivello * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-7577272 */ specify("HTMLDocument11", () => { var success; var nodeList; var testNode; var vanchors; var vlength; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("document"); vanchors = doc.anchors; vlength = vanchors.length; assert.equal(vlength, 1, "lengthLink"); }); /** * The getElementsByName method returns the (possibly empty) collection of elements whose name value is given by the elementName. Retrieve all the elements whose name attribute is "mapid". Check the length of the nodelist. It should be 1. * @author NIST * @author Rick Rivello * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-71555259 */ specify("HTMLDocument13", () => { var success; var nodeList; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("document"); nodeList = doc.getElementsByName("mapid"); assert.equal(nodeList.length, 1, 'Asize'); }); /** * The getElementsByName method returns the (possibly empty) collection of elements whose name value is given by the elementName. Retrieve all the elements whose name attribute is "noid". Check the length of the nodelist. It should be 0 since the id "noid" does not exist. * @author NIST * @author Rick Rivello * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-71555259 */ specify("HTMLDocument14", () => { var success; var nodeList; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("document"); nodeList = doc.getElementsByName("noid"); assert.equal(nodeList.length, 0, 'Asize'); }); /** * The getElementById method returns the Element whose id is given by elementId. If no such element exists, returns null. Retrieve the element whose id is "mapid". Check the value of the element. * @author NIST * @author Rick Rivello * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-36113835 * @see http://www.w3.org/TR/DOM-Level-2-HTML/html#ID-26809268 * @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-getElBId */ specify("HTMLDocument15", () => { var success; var elementNode; var elementValue; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("document"); elementNode = doc.getElementById("mapid"); elementValue = elementNode.nodeName; assert.equal(elementValue, 'MAP', 'elementId'); }); /** * The getElementById method returns the Element whose id is given by elementId. If no such element exists, returns null. Retrieve the element whose id is "noid". The value returned should be null since there are not any elements with an id of "noid". * @author NIST * @author Rick Rivello * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-36113835 * @see http://www.w3.org/TR/DOM-Level-2-HTML/html#ID-26809268 * @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-getElBId */ specify("HTMLDocument16", () => { var success; var elementNode; var elementValue; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("document"); elementNode = doc.getElementById("noid"); assert.equal(elementNode, null, 'elementNode should be null'); }); /** * Clears the current document using HTMLDocument.open immediately followed by close. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-72161170 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-98948567 */ specify("HTMLDocument17", () => { var success; var doc; var bodyElem; var bodyChild; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("document"); doc.open(); doc.close(); bodyElem = doc.body; if( (bodyElem != null) ) { bodyChild = bodyElem.firstChild; assert.equal(bodyChild, null, 'bodyChild should be null'); } }); /** * Calls HTMLDocument.close on a document that has not been opened for modification. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-98948567 */ specify("HTMLDocument18", () => { var success; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("document"); doc.close(); }); /** * Replaces the current document with a valid HTML document using HTMLDocument.open, write and close. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-72161170 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-98948567 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-75233634 */ specify("HTMLDocument19", () => { var success; var doc; var docElem; var title; doc = load("document"); doc.open(); doc.write("<html>"); doc.write("<body>"); doc.write("<title>Replacement</title>"); doc.write("</body>"); doc.write("<p>"); doc.write("Hello, World."); doc.write("</p>"); doc.write("</body>"); doc.write("</html>"); doc.close(); }); /** * Replaces the current document with a valid HTML document using HTMLDocument.open, writeln and close. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-72161170 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-98948567 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-35318390 */ specify("HTMLDocument20", () => { var success; var doc; var docElem; var title; doc = load("document"); doc.open(); doc.writeln("<html>"); doc.writeln("<body>"); doc.writeln("<title>Replacement</title>"); doc.writeln("</body>"); doc.writeln("<p>"); doc.writeln("Hello, World."); doc.writeln("</p>"); doc.writeln("</body>"); doc.writeln("</html>"); doc.close(); }); /** * Replaces the current document checks that writeln adds a new line. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-72161170 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-98948567 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-75233634 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-35318390 */ specify("HTMLDocument21", () => { var doc = load("document"); doc.open(); doc.writeln("<html>"); doc.writeln("<body>"); doc.writeln("<title>Replacement</title>"); doc.writeln("</body>"); doc.write("<pre>"); doc.writeln("Hello, World."); doc.writeln("Hello, World."); doc.writeln("</pre>"); doc.write("<pre>"); doc.write("Hello, World."); doc.write("Hello, World."); doc.writeln("</pre>"); doc.writeln("</body>"); doc.writeln("</html>"); doc.close(); }); /** * The id specifies the elements identifier. Retrieve the id attribute of the HEAD element and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-63534901 */ specify("HTMLElement01", () => { var success; var nodeList; var testNode; var vid; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("element"); nodeList = doc.getElementsByTagName("head"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vid = testNode.id; assert.equal(vid, "Test-HEAD", "idLink"); }); /** * The id specifies the elements identifier. Retrieve the id attribute of the SUB element and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-63534901 */ specify("HTMLElement02", () => { var success; var nodeList; var testNode; var vid; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("element"); nodeList = doc.getElementsByTagName("sub"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vid = testNode.id; assert.equal(vid, "Test-SUB", "idLink"); }); /** * The id specifies the elements identifier. Retrieve the id attribute of the SUP element and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-63534901 */ specify("HTMLElement03", () => { var success; var nodeList; var testNode; var vid; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("element"); nodeList = doc.getElementsByTagName("sup"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vid = testNode.id; assert.equal(vid, "Test-SUP", "idLink"); }); /** * The id specifies the elements identifier. Retrieve the id attribute of the SPAN element and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-63534901 */ specify("HTMLElement04", () => { var success; var nodeList; var testNode; var vid; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("element"); nodeList = doc.getElementsByTagName("span"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vid = testNode.id; assert.equal(vid, "Test-SPAN", "idLink"); }); /** * The id specifies the elements identifier. Retrieve the id attribute of the BDO element and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-63534901 */ specify("HTMLElement05", () => { var success; var nodeList; var testNode; var vid; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("element"); nodeList = doc.getElementsByTagName("bdo"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vid = testNode.id; assert.equal(vid, "Test-BDO", "idLink"); }); /** * The id specifies the elements identifier. Retrieve the id attribute of the TT element and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-63534901 */ specify("HTMLElement06", () => { var success; var nodeList; var testNode; var vid; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("element"); nodeList = doc.getElementsByTagName("tt"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vid = testNode.id; assert.equal(vid, "Test-TT", "idLink"); }); /** * The id specifies the elements identifier. Retrieve the id attribute of the I element and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-63534901 */ specify("HTMLElement07", () => { var success; var nodeList; var testNode; var vid; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("element"); nodeList = doc.getElementsByTagName("i"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vid = testNode.id; assert.equal(vid, "Test-I", "idLink"); }); /** * The id specifies the elements identifier. Retrieve the id attribute of the B element and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-63534901 */ specify("HTMLElement08", () => { var success; var nodeList; var testNode; var vid; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("element"); nodeList = doc.getElementsByTagName("b"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vid = testNode.id; assert.equal(vid, "Test-B", "idLink"); }); /** * The id specifies the elements identifier. Retrieve the id attribute of the U element and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-63534901 */ specify("HTMLElement09", () => { var success; var nodeList; var testNode; var vid; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("element"); nodeList = doc.getElementsByTagName("u"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vid = testNode.id; assert.equal(vid, "Test-U", "idLink"); }); /** * The id specifies the elements identifier. Retrieve the id attribute of the S element and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-63534901 */ specify("HTMLElement10", () => { var success; var nodeList; var testNode; var vid; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("element"); nodeList = doc.getElementsByTagName("s"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vid = testNode.id; assert.equal(vid, "Test-S", "idLink"); }); /** * The dir attribute specifies the base direction of directionally neutral text and the directionality of tables. Retrieve the dir attribute of the SMALL element and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-52460740 */ specify("HTMLElement100", () => { var success; var nodeList; var testNode; var vdir; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("element"); nodeList = doc.getElementsByTagName("small"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vdir = testNode.dir; assert.equal(vdir, "ltr", "dirLink"); }); /** * The dir attribute specifies the base direction of directionally neutral text and the directionality of tables. Retrieve the dir attribute of the EM element and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-52460740 */ specify("HTMLElement101", () => { var success; var nodeList; var testNode; var vdir; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("element"); nodeList = doc.getElementsByTagName("em"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vdir = testNode.dir; assert.equal(vdir, "ltr", "dirLink"); }); /** * The dir attribute specifies the base direction of directionally neutral text and the directionality of tables. Retrieve the dir attribute of the STRONG element and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-52460740 */ specify("HTMLElement102", () => { var success; var nodeList; var testNode; var vdir; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("element"); nodeList = doc.getElementsByTagName("strong"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vdir = testNode.dir; assert.equal(vdir, "ltr", "dirLink"); }); /** * The dir attribute specifies the base direction of directionally neutral text and the directionality of tables. Retrieve the dir attribute of the DFN element and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-52460740 */ specify("HTMLElement103", () => { var success; var nodeList; var testNode; var vdir; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("element"); nodeList = doc.getElementsByTagName("dfn"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vdir = testNode.dir; assert.equal(vdir, "ltr", "dirLink"); }); /** * The dir attribute specifies the base direction of directionally neutral text and the directionality of tables. Retrieve the dir attribute of the CODE element and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-52460740 */ specify("HTMLElement104", () => { var success; var nodeList; var testNode; var vdir; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("element"); nodeList = doc.getElementsByTagName("code"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vdir = testNode.dir; assert.equal(vdir, "ltr", "dirLink"); }); /** * The dir attribute specifies the base direction of directionally neutral text and the directionality of tables. Retrieve the dir attribute of the SAMP element and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-52460740 */ specify("HTMLElement105", () => { var success; var nodeList; var testNode; var vdir; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("element"); nodeList = doc.getElementsByTagName("samp"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vdir = testNode.dir; assert.equal(vdir, "ltr", "dirLink"); }); /** * The dir attribute specifies the base direction of directionally neutral text and the directionality of tables. Retrieve the dir attribute of the KBD element and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-52460740 */ specify("HTMLElement106", () => { var success; var nodeList; var testNode; var vdir; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("element"); nodeList = doc.getElementsByTagName("kbd"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vdir = testNode.dir; assert.equal(vdir, "ltr", "dirLink"); }); /** * The dir attribute specifies the base direction of directionally neutral text and the directionality of tables. Retrieve the dir attribute of the VAR element and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-52460740 */ specify("HTMLElement107", () => { var success; var nodeList; var testNode; var vdir; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("element"); nodeList = doc.getElementsByTagName("var"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vdir = testNode.dir; assert.equal(vdir, "ltr", "dirLink"); }); /** * The dir attribute specifies the base direction of directionally neutral text and the directionality of tables. Retrieve the dir attribute of the CITE element and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-52460740 */ specify("HTMLElement108", () => { var success; var nodeList; var testNode; var vdir; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("element"); nodeList = doc.getElementsByTagName("cite"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vdir = testNode.dir; assert.equal(vdir, "ltr", "dirLink"); }); /** * The dir attribute specifies the base direction of directionally neutral text and the directionality of tables. Retrieve the dir attribute of the ACRONYM element and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-52460740 */ specify("HTMLElement109", () => { var success; var nodeList; var testNode; var vdir; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("element"); nodeList = doc.getElementsByTagName("acronym"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vdir = testNode.dir; assert.equal(vdir, "ltr", "dirLink"); }); /** * The id specifies the elements identifier. Retrieve the id attribute of the STRIKE element and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-63534901 */ specify("HTMLElement11", () => { var success; var nodeList; var testNode; var vid; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("element"); nodeList = doc.getElementsByTagName("strike"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vid = testNode.id; assert.equal(vid, "Test-STRIKE", "idLink"); }); /** * The dir attribute specifies the base direction of directionally neutral text and the directionality of tables. Retrieve the dir attribute of the ABBR element and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-52460740 */ specify("HTMLElement110", () => { var success; var nodeList; var testNode; var vdir; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("element"); nodeList = doc.getElementsByTagName("abbr"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vdir = testNode.dir; assert.equal(vdir, "ltr", "dirLink"); }); /** * The dir attribute specifies the base direction of directionally neutral text and the directionality of tables. Retrieve the dir attribute of the DD element and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-52460740 */ specify("HTMLElement111", () => { var success; var nodeList; var testNode; var vdir; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("element"); nodeList = doc.getElementsByTagName("dd"); assert.equal(nodeList.length, 4, 'Asize'); testNode = nodeList.item(0); vdir = testNode.dir; assert.equal(vdir, "ltr", "dirLink"); }); /** * The dir attribute specifies the base direction of directionally neutral text and the directionality of tables. Retrieve the dir attribute of the DT element and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-52460740 */ specify("HTMLElement112", () => { var success; var nodeList; var testNode; var vdir; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("element"); nodeList = doc.getElementsByTagName("dt"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vdir = testNode.dir; assert.equal(vdir, "ltr", "dirLink"); }); /** * The dir attribute specifies the base direction of directionally neutral text and the directionality of tables. Retrieve the dir attribute of the NOFRAMES element and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-52460740 */ specify("HTMLElement113", () => { var success; var nodeList; var testNode; var vdir; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("element"); nodeList = doc.getElementsByTagName("noframes"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vdir = testNode.dir; assert.equal(vdir, "ltr", "dirLink"); }); /** * The dir attribute specifies the base direction of directionally neutral text and the directionality of tables. Retrieve the dir attribute of the NOSCRIPT element and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-52460740 */ specify("HTMLElement114", () => { var success; var nodeList; var testNode; var vdir; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("element"); nodeList = doc.getElementsByTagName("noscript"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vdir = testNode.dir; assert.equal(vdir, "ltr", "dirLink"); }); /** * The dir attribute specifies the base direction of directionally neutral text and the directionality of tables. Retrieve the dir attribute of the ADDRESS element and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-52460740 */ specify("HTMLElement115", () => { var success; var nodeList; var testNode; var vdir; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("element"); nodeList = doc.getElementsByTagName("address"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vdir = testNode.dir; assert.equal(vdir, "ltr", "dirLink"); }); /** * The dir attribute specifies the base direction of directionally neutral text and the directionality of tables. Retrieve the dir attribute of the CENTER element and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-52460740 */ specify("HTMLElement116", () => { var success; var nodeList; var testNode; var vdir; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("element"); nodeList = doc.getElementsByTagName("center"); assert.equal(nodeList.length, 2, 'Asize'); testNode = nodeList.item(0); vdir = testNode.dir; assert.equal(vdir, "ltr", "dirLink"); }); /** * The className attribute specifies the class attribute of the element. Retrieve the class attribute of the HEAD element and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-95362176 */ specify("HTMLElement117", () => { var success; var nodeList; var testNode; var vclassname; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("element"); nodeList = doc.getElementsByTagName("head"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vclassname = testNode.className; assert.equal(vclassname, "HEAD-class", "classNameLink"); }); /** * The className attribute specifies the class attribute of the element. Retrieve the class attribute of the SUB element and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-95362176 */ specify("HTMLElement118", () => { var success; var nodeList; var testNode; var vclassname; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("element"); nodeList = doc.getElementsByTagName("sub"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vclassname = testNode.className; assert.equal(vclassname, "SUB-class", "classNameLink"); }); /** * The className attribute specifies the class attribute of the element. Retrieve the class attribute of the SUP element and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-95362176 */ specify("HTMLElement119", () => { var success; var nodeList; var testNode; var vclassname; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("element"); nodeList = doc.getElementsByTagName("sup"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vclassname = testNode.className; assert.equal(vclassname, "SUP-class", "classNameLink"); }); /** * The id specifies the elements identifier. Retrieve the id attribute of the BIG element and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-63534901 */ specify("HTMLElement12", () => { var success; var nodeList; var testNode; var vid; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("element"); nodeList = doc.getElementsByTagName("big"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vid = testNode.id; assert.equal(vid, "Test-BIG", "idLink"); }); /** * The className attribute specifies the class attribute of the element. Retrieve the class attribute of the SPAN element and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-95362176 */ specify("HTMLElement120", () => { var success; var nodeList; var testNode; var vclassname; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("element"); nodeList = doc.getElementsByTagName("span"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vclassname = testNode.className; assert.equal(vclassname, "SPAN-class", "classNameLink"); }); /** * The className attribute specifies the class attribute of the element. Retrieve the class attribute of the BDO element and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-95362176 */ specify("HTMLElement121", () => { var success; var nodeList; var testNode; var vclassname; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("element"); nodeList = doc.getElementsByTagName("bdo"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vclassname = testNode.className; assert.equal(vclassname, "BDO-class", "classNameLink"); }); /** * The className attribute specifies the class attribute of the element. Retrieve the class attribute of the TT element and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-95362176 */ specify("HTMLElement122", () => { var success; var nodeList; var testNode; var vclassname; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("element"); nodeList = doc.getElementsByTagName("tt"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vclassname = testNode.className; assert.equal(vclassname, "TT-class", "classNameLink"); }); /** * The className attribute specifies the class attribute of the element. Retrieve the class attribute of the I element and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-95362176 */ specify("HTMLElement123", () => { var success; var nodeList; var testNode; var vclassname; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("element"); nodeList = doc.getElementsByTagName("i"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vclassname = testNode.className; assert.equal(vclassname, "I-class", "classNameLink"); }); /** * The className attribute specifies the class attribute of the element. Retrieve the class attribute of the B element and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-95362176 */ specify("HTMLElement124", () => { var success; var nodeList; var testNode; var vclassname; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("element"); nodeList = doc.getElementsByTagName("b"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vclassname = testNode.className; assert.equal(vclassname, "B-class", "classNameLink"); }); /** * The className attribute specifies the class attribute of the element. Retrieve the class attribute of the U element and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-95362176 */ specify("HTMLElement125", () => { var success; var nodeList; var testNode; var vclassname; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("element"); nodeList = doc.getElementsByTagName("u"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vclassname = testNode.className; assert.equal(vclassname, "U-class", "classNameLink"); }); /** * The className attribute specifies the class attribute of the element. Retrieve the class attribute of the S element and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-95362176 */ specify("HTMLElement126", () => { var success; var nodeList; var testNode; var vclassname; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("element"); nodeList = doc.getElementsByTagName("s"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vclassname = testNode.className; assert.equal(vclassname, "S-class", "classNameLink"); }); /** * The className attribute specifies the class attribute of the element. Retrieve the class attribute of the STRIKE element and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-95362176 */ specify("HTMLElement127", () => { var success; var nodeList; var testNode; var vclassname; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("element"); nodeList = doc.getElementsByTagName("strike"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vclassname = testNode.className; assert.equal(vclassname, "STRIKE-class", "classNameLink"); }); /** * The className attribute specifies the class attribute of the element. Retrieve the class attribute of the BIG element and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-95362176 */ specify("HTMLElement128", () => { var success; var nodeList; var testNode; var vclassname; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("element"); nodeList = doc.getElementsByTagName("big"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vclassname = testNode.className; assert.equal(vclassname, "BIG-class", "classNameLink"); }); /** * The className attribute specifies the class attribute of the element. Retrieve the class attribute of the SMALL element and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-95362176 */ specify("HTMLElement129", () => { var success; var nodeList; var testNode; var vclassname; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("element"); nodeList = doc.getElementsByTagName("small"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vclassname = testNode.className; assert.equal(vclassname, "SMALL-class", "classNameLink"); }); /** * The id specifies the elements identifier. Retrieve the id attribute of the SMALL element and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-63534901 */ specify("HTMLElement13", () => { var success; var nodeList; var testNode; var vid; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("element"); nodeList = doc.getElementsByTagName("small"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vid = testNode.id; assert.equal(vid, "Test-SMALL", "idLink"); }); /** * The className attribute specifies the class attribute of the element. Retrieve the class attribute of the EM element and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-95362176 */ specify("HTMLElement130", () => { var success; var nodeList; var testNode; var vclassname; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("element"); nodeList = doc.getElementsByTagName("em"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vclassname = testNode.className; assert.equal(vclassname, "EM-class", "classNameLink"); }); /** * The className attribute specifies the class attribute of the element. Retrieve the class attribute of the STRONG element and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-95362176 */ specify("HTMLElement131", () => { var success; var nodeList; var testNode; var vclassname; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("element"); nodeList = doc.getElementsByTagName("strong"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vclassname = testNode.className; assert.equal(vclassname, "STRONG-class", "classNameLink"); }); /** * The className attribute specifies the class attribute of the element. Retrieve the class attribute of the DFN element and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-95362176 */ specify("HTMLElement132", () => { var success; var nodeList; var testNode; var vclassname; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("element"); nodeList = doc.getElementsByTagName("dfn"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vclassname = testNode.className; assert.equal(vclassname, "DFN-class", "classNameLink"); }); /** * The className attribute specifies the class attribute of the element. Retrieve the class attribute of the CODE element and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-95362176 */ specify("HTMLElement133", () => { var success; var nodeList; var testNode; var vclassname; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("element"); nodeList = doc.getElementsByTagName("code"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vclassname = testNode.className; assert.equal(vclassname, "CODE-class", "classNameLink"); }); /** * The className attribute specifies the class attribute of the element. Retrieve the class attribute of the SAMP element and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-95362176 */ specify("HTMLElement134", () => { var success; var nodeList; var testNode; var vclassname; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("element"); nodeList = doc.getElementsByTagName("samp"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vclassname = testNode.className; assert.equal(vclassname, "SAMP-class", "classNameLink"); }); /** * The className attribute specifies the class attribute of the element. Retrieve the class attribute of the KBD element and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-95362176 */ specify("HTMLElement135", () => { var success; var nodeList; var testNode; var vclassname; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("element"); nodeList = doc.getElementsByTagName("kbd"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vclassname = testNode.className; assert.equal(vclassname, "KBD-class", "classNameLink"); }); /** * The className attribute specifies the class attribute of the element. Retrieve the class attribute of the VAR element and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-95362176 */ specify("HTMLElement136", () => { var success; var nodeList; var testNode; var vclassname; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("element"); nodeList = doc.getElementsByTagName("var"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vclassname = testNode.className; assert.equal(vclassname, "VAR-class", "classNameLink"); }); /** * The className attribute specifies the class attribute of the element. Retrieve the class attribute of the CITE element and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-95362176 */ specify("HTMLElement137", () => { var success; var nodeList; var testNode; var vclassname; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("element"); nodeList = doc.getElementsByTagName("cite"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vclassname = testNode.className; assert.equal(vclassname, "CITE-class", "classNameLink"); }); /** * The className attribute specifies the class attribute of the element. Retrieve the class attribute of the ACRONYM element and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-95362176 */ specify("HTMLElement138", () => { var success; var nodeList; var testNode; var vclassname; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("element"); nodeList = doc.getElementsByTagName("acronym"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vclassname = testNode.className; assert.equal(vclassname, "ACRONYM-class", "classNameLink"); }); /** * The className attribute specifies the class attribute of the element. Retrieve the class attribute of the ABBR element and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-95362176 */ specify("HTMLElement139", () => { var success; var nodeList; var testNode; var vclassname; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("element"); nodeList = doc.getElementsByTagName("abbr"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vclassname = testNode.className; assert.equal(vclassname, "ABBR-class", "classNameLink"); }); /** * The id specifies the elements identifier. Retrieve the id attribute of the EM element and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-63534901 */ specify("HTMLElement14", () => { var success; var nodeList; var testNode; var vid; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("element"); nodeList = doc.getElementsByTagName("em"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vid = testNode.id; assert.equal(vid, "Test-EM", "idLink"); }); /** * The className attribute specifies the class attribute of the element. Retrieve the class attribute of the DD element and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-95362176 */ specify("HTMLElement140", () => { var success; var nodeList; var testNode; var vclassname; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("element"); nodeList = doc.getElementsByTagName("dd"); assert.equal(nodeList.length, 4, 'Asize'); testNode = nodeList.item(0); vclassname = testNode.className; assert.equal(vclassname, "DD-class", "classNameLink"); }); /** * The className attribute specifies the class attribute of the element. Retrieve the class attribute of the DT element and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-95362176 */ specify("HTMLElement141", () => { var success; var nodeList; var testNode; var vclassname; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("element"); nodeList = doc.getElementsByTagName("dt"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vclassname = testNode.className; assert.equal(vclassname, "DT-class", "classNameLink"); }); /** * The className attribute specifies the class attribute of the element. Retrieve the class attribute of the NOFRAMES element and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-95362176 */ specify("HTMLElement142", () => { var success; var nodeList; var testNode; var vclassname; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("element"); nodeList = doc.getElementsByTagName("noframes"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vclassname = testNode.className; assert.equal(vclassname, "NOFRAMES-class", "classNameLink"); }); /** * The className attribute specifies the class attribute of the element. Retrieve the class attribute of the NOSCRIPT element and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-95362176 */ specify("HTMLElement143", () => { var success; var nodeList; var testNode; var vclassname; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("element"); nodeList = doc.getElementsByTagName("noscript"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vclassname = testNode.className; assert.equal(vclassname, "NOSCRIPT-class", "classNameLink"); }); /** * The className attribute specifies the class attribute of the element. Retrieve the class attribute of the ADDRESS element and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-95362176 */ specify("HTMLElement144", () => { var success; var nodeList; var testNode; var vclassname; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("element"); nodeList = doc.getElementsByTagName("address"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vclassname = testNode.className; assert.equal(vclassname, "ADDRESS-class", "classNameLink"); }); /** * The className attribute specifies the class attribute of the element. Retrieve the class attribute of the CENTER element and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-95362176 */ specify("HTMLElement145", () => { var success; var nodeList; var testNode; var vclassname; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("element"); nodeList = doc.getElementsByTagName("center"); assert.equal(nodeList.length, 2, 'Asize'); testNode = nodeList.item(0); vclassname = testNode.className; assert.equal(vclassname, "CENTER-class", "classNameLink"); }); /** * The id specifies the elements identifier. Retrieve the id attribute of the STRONG element and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-63534901 */ specify("HTMLElement15", () => { var success; var nodeList; var testNode; var vid; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("element"); nodeList = doc.getElementsByTagName("strong"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vid = testNode.id; assert.equal(vid, "Test-STRONG", "idLink"); }); /** * The id specifies the elements identifier. Retrieve the id attribute of the DFN element and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-63534901 */ specify("HTMLElement16", () => { var success; var nodeList; var testNode; var vid; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("element"); nodeList = doc.getElementsByTagName("dfn"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vid = testNode.id; assert.equal(vid, "Test-DFN", "idLink"); }); /** * The id specifies the elements identifier. Retrieve the id attribute of the CODE element and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-63534901 */ specify("HTMLElement17", () => { var success; var nodeList; var testNode; var vid; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("element"); nodeList = doc.getElementsByTagName("code"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vid = testNode.id; assert.equal(vid, "Test-CODE", "idLink"); }); /** * The id specifies the elements identifier. Retrieve the id attribute of the SAMP element and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-63534901 */ specify("HTMLElement18", () => { var success; var nodeList; var testNode; var vid; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("element"); nodeList = doc.getElementsByTagName("samp"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vid = testNode.id; assert.equal(vid, "Test-SAMP", "idLink"); }); /** * The id specifies the elements identifier. Retrieve the id attribute of the KBD element and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-63534901 */ specify("HTMLElement19", () => { var success; var nodeList; var testNode; var vid; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("element"); nodeList = doc.getElementsByTagName("kbd"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vid = testNode.id; assert.equal(vid, "Test-KBD", "idLink"); }); /** * The id specifies the elements identifier. Retrieve the id attribute of the VAR element and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-63534901 */ specify("HTMLElement20", () => { var success; var nodeList; var testNode; var vid; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("element"); nodeList = doc.getElementsByTagName("var"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vid = testNode.id; assert.equal(vid, "Test-VAR", "idLink"); }); /** * The id specifies the elements identifier. Retrieve the id attribute of the CITE element and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-63534901 */ specify("HTMLElement21", () => { var success; var nodeList; var testNode; var vid; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("element"); nodeList = doc.getElementsByTagName("cite"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vid = testNode.id; assert.equal(vid, "Test-CITE", "idLink"); }); /** * The id specifies the elements identifier. Retrieve the id attribute of the ACRONYM element and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-63534901 */ specify("HTMLElement22", () => { var success; var nodeList; var testNode; var vid; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("element"); nodeList = doc.getElementsByTagName("acronym"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vid = testNode.id; assert.equal(vid, "Test-ACRONYM", "idLink"); }); /** * The id specifies the elements identifier. Retrieve the id attribute of the ABBR element and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-63534901 */ specify("HTMLElement23", () => { var success; var nodeList; var testNode; var vid; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("element"); nodeList = doc.getElementsByTagName("abbr"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vid = testNode.id; assert.equal(vid, "Test-ABBR", "idLink"); }); /** * The id specifies the elements identifier. Retrieve the id attribute of the DD element and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-63534901 */ specify("HTMLElement24", () => { var success; var nodeList; var testNode; var vid; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("element"); nodeList = doc.getElementsByTagName("dd"); assert.equal(nodeList.length, 4, 'Asize'); testNode = nodeList.item(0); vid = testNode.id; assert.equal(vid, "Test-DD", "idLink"); }); /** * The id specifies the elements identifier. Retrieve the id attribute of the DT element and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-63534901 */ specify("HTMLElement25", () => { var success; var nodeList; var testNode; var vid; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("element"); nodeList = doc.getElementsByTagName("dt"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vid = testNode.id; assert.equal(vid, "Test-DT", "idLink"); }); /** * The id specifies the elements identifier. Retrieve the id attribute of the NOFRAMES element and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-63534901 */ specify("HTMLElement26", () => { var success; var nodeList; var testNode; var vid; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("element"); nodeList = doc.getElementsByTagName("noframes"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vid = testNode.id; assert.equal(vid, "Test-NOFRAMES", "idLink"); }); /** * The id specifies the elements identifier. Retrieve the id attribute of the NOSCRIPT element and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-63534901 */ specify("HTMLElement27", () => { var success; var nodeList; var testNode; var vid; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("element"); nodeList = doc.getElementsByTagName("noscript"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vid = testNode.id; assert.equal(vid, "Test-NOSCRIPT", "idLink"); }); /** * The id specifies the elements identifier. Retrieve the id attribute of the ADDRESS element and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-63534901 */ specify("HTMLElement28", () => { var success; var nodeList; var testNode; var vid; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("element"); nodeList = doc.getElementsByTagName("address"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vid = testNode.id; assert.equal(vid, "Test-ADDRESS", "idLink"); }); /** * The id specifies the elements identifier. Retrieve the id attribute of the CENTER element and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-63534901 */ specify("HTMLElement29", () => { var success; var nodeList; var testNode; var vid; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("element"); nodeList = doc.getElementsByTagName("center"); assert.equal(nodeList.length, 2, 'Asize'); testNode = nodeList.item(0); vid = testNode.id; assert.equal(vid, "Test-CENTER", "idLink"); }); /** * The title attribute specifies the elements advisory title. Retrieve the title attribute of the HEAD element and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-78276800 */ specify("HTMLElement30", () => { var success; var nodeList; var testNode; var vtitle; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("element"); nodeList = doc.getElementsByTagName("head"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vtitle = testNode.title; assert.equal(vtitle, "HEAD Element", "titleLink"); }); /** * The title attribute specifies the elements advisory title. Retrieve the title attribute of the SUB element and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-78276800 */ specify("HTMLElement31", () => { var success; var nodeList; var testNode; var vtitle; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("element"); nodeList = doc.getElementsByTagName("sub"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vtitle = testNode.title; assert.equal(vtitle, "SUB Element", "titleLink"); }); /** * The title attribute specifies the elements advisory title. Retrieve the title attribute of the SUP element and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-78276800 */ specify("HTMLElement32", () => { var success; var nodeList; var testNode; var vtitle; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("element"); nodeList = doc.getElementsByTagName("sup"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vtitle = testNode.title; assert.equal(vtitle, "SUP Element", "titleLink"); }); /** * The title attribute specifies the elements advisory title. Retrieve the title attribute of the SPAN element and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-78276800 */ specify("HTMLElement33", () => { var success; var nodeList; var testNode; var vtitle; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("element"); nodeList = doc.getElementsByTagName("span"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vtitle = testNode.title; assert.equal(vtitle, "SPAN Element", "titleLink"); }); /** * The title attribute specifies the elements advisory title. Retrieve the title attribute of the BDO element and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-78276800 */ specify("HTMLElement34", () => { var success; var nodeList; var testNode; var vtitle; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("element"); nodeList = doc.getElementsByTagName("bdo"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vtitle = testNode.title; assert.equal(vtitle, "BDO Element", "titleLink"); }); /** * The title attribute specifies the elements advisory title. Retrieve the title attribute of the TT element and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-78276800 */ specify("HTMLElement35", () => { var success; var nodeList; var testNode; var vtitle; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("element"); nodeList = doc.getElementsByTagName("tt"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vtitle = testNode.title; assert.equal(vtitle, "TT Element", "titleLink"); }); /** * The title attribute specifies the elements advisory title. Retrieve the title attribute of the I element and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-78276800 */ specify("HTMLElement36", () => { var success; var nodeList; var testNode; var vtitle; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("element"); nodeList = doc.getElementsByTagName("i"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vtitle = testNode.title; assert.equal(vtitle, "I Element", "titleLink"); }); /** * The title attribute specifies the elements advisory title. Retrieve the title attribute of the B element and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-78276800 */ specify("HTMLElement37", () => { var success; var nodeList; var testNode; var vtitle; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("element"); nodeList = doc.getElementsByTagName("b"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vtitle = testNode.title; assert.equal(vtitle, "B Element", "titleLink"); }); /** * The title attribute specifies the elements advisory title. Retrieve the title attribute of the U element and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-78276800 */ specify("HTMLElement38", () => { var success; var nodeList; var testNode; var vtitle; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("element"); nodeList = doc.getElementsByTagName("u"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vtitle = testNode.title; assert.equal(vtitle, "U Element", "titleLink"); }); /** * The title attribute specifies the elements advisory title. Retrieve the title attribute of the S element and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-78276800 */ specify("HTMLElement39", () => { var success; var nodeList; var testNode; var vtitle; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("element"); nodeList = doc.getElementsByTagName("s"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vtitle = testNode.title; assert.equal(vtitle, "S Element", "titleLink"); }); /** * The title attribute specifies the elements advisory title. Retrieve the title attribute of the STRIKE element and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-78276800 */ specify("HTMLElement40", () => { var success; var nodeList; var testNode; var vtitle; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("element"); nodeList = doc.getElementsByTagName("strike"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vtitle = testNode.title; assert.equal(vtitle, "STRIKE Element", "titleLink"); }); /** * The title attribute specifies the elements advisory title. Retrieve the title attribute of the BIG element and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-78276800 */ specify("HTMLElement41", () => { var success; var nodeList; var testNode; var vtitle; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("element"); nodeList = doc.getElementsByTagName("big"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vtitle = testNode.title; assert.equal(vtitle, "BIG Element", "titleLink"); }); /** * The title attribute specifies the elements advisory title. Retrieve the title attribute of the SMALL element and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-78276800 */ specify("HTMLElement42", () => { var success; var nodeList; var testNode; var vtitle; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("element"); nodeList = doc.getElementsByTagName("small"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vtitle = testNode.title; assert.equal(vtitle, "SMALL Element", "titleLink"); }); /** * The title attribute specifies the elements advisory title. Retrieve the title attribute of the EM element and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-78276800 */ specify("HTMLElement43", () => { var success; var nodeList; var testNode; var vtitle; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("element"); nodeList = doc.getElementsByTagName("em"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vtitle = testNode.title; assert.equal(vtitle, "EM Element", "titleLink"); }); /** * The title attribute specifies the elements advisory title. Retrieve the title attribute of the STRONG element and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-78276800 */ specify("HTMLElement44", () => { var success; var nodeList; var testNode; var vtitle; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("element"); nodeList = doc.getElementsByTagName("strong"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vtitle = testNode.title; assert.equal(vtitle, "STRONG Element", "titleLink"); }); /** * The title attribute specifies the elements advisory title. Retrieve the title attribute of the DFN element and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-78276800 */ specify("HTMLElement45", () => { var success; var nodeList; var testNode; var vtitle; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("element"); nodeList = doc.getElementsByTagName("dfn"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vtitle = testNode.title; assert.equal(vtitle, "DFN Element", "titleLink"); }); /** * The title attribute specifies the elements advisory title. Retrieve the title attribute of the CODE element and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-78276800 */ specify("HTMLElement46", () => { var success; var nodeList; var testNode; var vtitle; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("element"); nodeList = doc.getElementsByTagName("code"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vtitle = testNode.title; assert.equal(vtitle, "CODE Element", "titleLink"); }); /** * The title attribute specifies the elements advisory title. Retrieve the title attribute of the SAMP element and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-78276800 */ specify("HTMLElement47", () => { var success; var nodeList; var testNode; var vtitle; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("element"); nodeList = doc.getElementsByTagName("samp"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vtitle = testNode.title; assert.equal(vtitle, "SAMP Element", "titleLink"); }); /** * The title attribute specifies the elements advisory title. Retrieve the title attribute of the KBD element and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-78276800 */ specify("HTMLElement48", () => { var success; var nodeList; var testNode; var vtitle; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("element"); nodeList = doc.getElementsByTagName("kbd"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vtitle = testNode.title; assert.equal(vtitle, "KBD Element", "titleLink"); }); /** * The title attribute specifies the elements advisory title. Retrieve the title attribute of the VAR element and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-78276800 */ specify("HTMLElement49", () => { var success; var nodeList; var testNode; var vtitle; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("element"); nodeList = doc.getElementsByTagName("var"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vtitle = testNode.title; assert.equal(vtitle, "VAR Element", "titleLink"); }); /** * The title attribute specifies the elements advisory title. Retrieve the title attribute of the CITE element and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-78276800 */ specify("HTMLElement50", () => { var success; var nodeList; var testNode; var vtitle; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("element"); nodeList = doc.getElementsByTagName("cite"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vtitle = testNode.title; assert.equal(vtitle, "CITE Element", "titleLink"); }); /** * The title attribute specifies the elements advisory title. Retrieve the title attribute of the ACRONYM element and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-78276800 */ specify("HTMLElement51", () => { var success; var nodeList; var testNode; var vtitle; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("element"); nodeList = doc.getElementsByTagName("acronym"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vtitle = testNode.title; assert.equal(vtitle, "ACRONYM Element", "titleLink"); }); /** * The title attribute specifies the elements advisory title. Retrieve the title attribute of the ABBR element and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-78276800 */ specify("HTMLElement52", () => { var success; var nodeList; var testNode; var vtitle; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("element"); nodeList = doc.getElementsByTagName("abbr"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vtitle = testNode.title; assert.equal(vtitle, "ABBR Element", "titleLink"); }); /** * The title attribute specifies the elements advisory title. Retrieve the title attribute of the DD element and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-78276800 */ specify("HTMLElement53", () => { var success; var nodeList; var testNode; var vtitle; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("element"); nodeList = doc.getElementsByTagName("dd"); assert.equal(nodeList.length, 4, 'Asize'); testNode = nodeList.item(0); vtitle = testNode.title; assert.equal(vtitle, "DD Element", "titleLink"); }); /** * The title attribute specifies the elements advisory title. Retrieve the title attribute of the DT element and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-78276800 */ specify("HTMLElement54", () => { var success; var nodeList; var testNode; var vtitle; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("element"); nodeList = doc.getElementsByTagName("dt"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vtitle = testNode.title; assert.equal(vtitle, "DT Element", "titleLink"); }); /** * The title attribute specifies the elements advisory title. Retrieve the title attribute of the NOFRAMES element and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-78276800 */ specify("HTMLElement55", () => { var success; var nodeList; var testNode; var vtitle; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("element"); nodeList = doc.getElementsByTagName("noframes"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vtitle = testNode.title; assert.equal(vtitle, "NOFRAMES Element", "titleLink"); }); /** * The title attribute specifies the elements advisory title. Retrieve the title attribute of the NOSCRIPT element and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-78276800 */ specify("HTMLElement56", () => { var success; var nodeList; var testNode; var vtitle; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("element"); nodeList = doc.getElementsByTagName("noscript"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vtitle = testNode.title; assert.equal(vtitle, "NOSCRIPT Element", "titleLink"); }); /** * The title attribute specifies the elements advisory title. Retrieve the title attribute of the ADDRESS element and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-78276800 */ specify("HTMLElement57", () => { var success; var nodeList; var testNode; var vtitle; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("element"); nodeList = doc.getElementsByTagName("address"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vtitle = testNode.title; assert.equal(vtitle, "ADDRESS Element", "titleLink"); }); /** * The title attribute specifies the elements advisory title. Retrieve the title attribute of the CENTER element and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-78276800 */ specify("HTMLElement58", () => { var success; var nodeList; var testNode; var vtitle; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("element"); nodeList = doc.getElementsByTagName("center"); assert.equal(nodeList.length, 2, 'Asize'); testNode = nodeList.item(0); vtitle = testNode.title; assert.equal(vtitle, "CENTER Element", "titleLink"); }); /** * The lang attribute specifies the language code defined in RFC 1766. Retrieve the lang attribute of the HEAD element and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-59132807 */ specify("HTMLElement59", () => { var success; var nodeList; var testNode; var vlang; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("element"); nodeList = doc.getElementsByTagName("head"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vlang = testNode.lang; assert.equal(vlang, "en", "langLink"); }); /** * The lang attribute specifies the language code defined in RFC 1766. Retrieve the lang attribute of the SUB element and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-59132807 */ specify("HTMLElement60", () => { var success; var nodeList; var testNode; var vlang; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("element"); nodeList = doc.getElementsByTagName("sub"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vlang = testNode.lang; assert.equal(vlang, "en", "langLink"); }); /** * The lang attribute specifies the language code defined in RFC 1766. Retrieve the lang attribute of the SUP element and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-59132807 */ specify("HTMLElement61", () => { var success; var nodeList; var testNode; var vlang; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("element"); nodeList = doc.getElementsByTagName("sup"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vlang = testNode.lang; assert.equal(vlang, "en", "langLink"); }); /** * The lang attribute specifies the language code defined in RFC 1766. Retrieve the lang attribute of the SPAN element and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-59132807 */ specify("HTMLElement62", () => { var success; var nodeList; var testNode; var vlang; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("element"); nodeList = doc.getElementsByTagName("span"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vlang = testNode.lang; assert.equal(vlang, "en", "langLink"); }); /** * The lang attribute specifies the language code defined in RFC 1766. Retrieve the lang attribute of the BDO element and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-59132807 */ specify("HTMLElement63", () => { var success; var nodeList; var testNode; var vlang; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("element"); nodeList = doc.getElementsByTagName("bdo"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vlang = testNode.lang; assert.equal(vlang, "en", "langLink"); }); /** * The lang attribute specifies the language code defined in RFC 1766. Retrieve the lang attribute of the TT element and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-59132807 */ specify("HTMLElement64", () => { var success; var nodeList; var testNode; var vlang; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("element"); nodeList = doc.getElementsByTagName("tt"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vlang = testNode.lang; assert.equal(vlang, "en", "langLink"); }); /** * The lang attribute specifies the language code defined in RFC 1766. Retrieve the lang attribute of the I element and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-59132807 */ specify("HTMLElement65", () => { var success; var nodeList; var testNode; var vlang; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("element"); nodeList = doc.getElementsByTagName("i"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vlang = testNode.lang; assert.equal(vlang, "en", "langLink"); }); /** * The lang attribute specifies the language code defined in RFC 1766. Retrieve the lang attribute of the B element and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-59132807 */ specify("HTMLElement66", () => { var success; var nodeList; var testNode; var vlang; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("element"); nodeList = doc.getElementsByTagName("b"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vlang = testNode.lang; assert.equal(vlang, "en", "langLink"); }); /** * The lang attribute specifies the language code defined in RFC 1766. Retrieve the lang attribute of the U element and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-59132807 */ specify("HTMLElement67", () => { var success; var nodeList; var testNode; var vlang; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("element"); nodeList = doc.getElementsByTagName("u"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vlang = testNode.lang; assert.equal(vlang, "en", "langLink"); }); /** * The lang attribute specifies the language code defined in RFC 1766. Retrieve the lang attribute of the S element and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-59132807 */ specify("HTMLElement68", () => { var success; var nodeList; var testNode; var vlang; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("element"); nodeList = doc.getElementsByTagName("s"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vlang = testNode.lang; assert.equal(vlang, "en", "langLink"); }); /** * The lang attribute specifies the language code defined in RFC 1766. Retrieve the lang attribute of the STRIKE element and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-59132807 */ specify("HTMLElement69", () => { var success; var nodeList; var testNode; var vlang; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("element"); nodeList = doc.getElementsByTagName("strike"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vlang = testNode.lang; assert.equal(vlang, "en", "langLink"); }); /** * The lang attribute specifies the language code defined in RFC 1766. Retrieve the lang attribute of the BIG element and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-59132807 */ specify("HTMLElement70", () => { var success; var nodeList; var testNode; var vlang; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("element"); nodeList = doc.getElementsByTagName("big"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vlang = testNode.lang; assert.equal(vlang, "en", "langLink"); }); /** * The lang attribute specifies the language code defined in RFC 1766. Retrieve the lang attribute of the SMALL element and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-59132807 */ specify("HTMLElement71", () => { var success; var nodeList; var testNode; var vlang; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("element"); nodeList = doc.getElementsByTagName("small"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vlang = testNode.lang; assert.equal(vlang, "en", "langLink"); }); /** * The lang attribute specifies the language code defined in RFC 1766. Retrieve the lang attribute of the EM element and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-59132807 */ specify("HTMLElement72", () => { var success; var nodeList; var testNode; var vlang; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("element"); nodeList = doc.getElementsByTagName("em"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vlang = testNode.lang; assert.equal(vlang, "en", "langLink"); }); /** * The lang attribute specifies the language code defined in RFC 1766. Retrieve the lang attribute of the STRONG element and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-59132807 */ specify("HTMLElement73", () => { var success; var nodeList; var testNode; var vlang; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("element"); nodeList = doc.getElementsByTagName("strong"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vlang = testNode.lang; assert.equal(vlang, "en", "langLink"); }); /** * The lang attribute specifies the language code defined in RFC 1766. Retrieve the lang attribute of the DFN element and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-59132807 */ specify("HTMLElement74", () => { var success; var nodeList; var testNode; var vlang; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("element"); nodeList = doc.getElementsByTagName("dfn"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vlang = testNode.lang; assert.equal(vlang, "en", "langLink"); }); /** * The lang attribute specifies the language code defined in RFC 1766. Retrieve the lang attribute of the CODE element and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-59132807 */ specify("HTMLElement75", () => { var success; var nodeList; var testNode; var vlang; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("element"); nodeList = doc.getElementsByTagName("code"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vlang = testNode.lang; assert.equal(vlang, "en", "langLink"); }); /** * The lang attribute specifies the language code defined in RFC 1766. Retrieve the lang attribute of the SAMP element and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-59132807 */ specify("HTMLElement76", () => { var success; var nodeList; var testNode; var vlang; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("element"); nodeList = doc.getElementsByTagName("samp"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vlang = testNode.lang; assert.equal(vlang, "en", "langLink"); }); /** * The lang attribute specifies the language code defined in RFC 1766. Retrieve the lang attribute of the KBD element and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-59132807 */ specify("HTMLElement77", () => { var success; var nodeList; var testNode; var vlang; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("element"); nodeList = doc.getElementsByTagName("kbd"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vlang = testNode.lang; assert.equal(vlang, "en", "langLink"); }); /** * The lang attribute specifies the language code defined in RFC 1766. Retrieve the lang attribute of the VAR element and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-59132807 */ specify("HTMLElement78", () => { var success; var nodeList; var testNode; var vlang; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("element"); nodeList = doc.getElementsByTagName("var"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vlang = testNode.lang; assert.equal(vlang, "en", "langLink"); }); /** * The lang attribute specifies the language code defined in RFC 1766. Retrieve the lang attribute of the CITE element and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-59132807 */ specify("HTMLElement79", () => { var success; var nodeList; var testNode; var vlang; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("element"); nodeList = doc.getElementsByTagName("cite"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vlang = testNode.lang; assert.equal(vlang, "en", "langLink"); }); /** * The lang attribute specifies the language code defined in RFC 1766. Retrieve the lang attribute of the ACRONYM element and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-59132807 */ specify("HTMLElement80", () => { var success; var nodeList; var testNode; var vlang; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("element"); nodeList = doc.getElementsByTagName("acronym"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vlang = testNode.lang; assert.equal(vlang, "en", "langLink"); }); /** * The lang attribute specifies the language code defined in RFC 1766. Retrieve the lang attribute of the ABBR element and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-59132807 */ specify("HTMLElement81", () => { var success; var nodeList; var testNode; var vlang; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("element"); nodeList = doc.getElementsByTagName("abbr"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vlang = testNode.lang; assert.equal(vlang, "en", "langLink"); }); /** * The lang attribute specifies the language code defined in RFC 1766. Retrieve the lang attribute of the DD element and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-59132807 */ specify("HTMLElement82", () => { var success; var nodeList; var testNode; var vlang; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("element"); nodeList = doc.getElementsByTagName("dd"); assert.equal(nodeList.length, 4, 'Asize'); testNode = nodeList.item(0); vlang = testNode.lang; assert.equal(vlang, "en", "langLink"); }); /** * The lang attribute specifies the language code defined in RFC 1766. Retrieve the lang attribute of the DT element and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-59132807 */ specify("HTMLElement83", () => { var success; var nodeList; var testNode; var vlang; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("element"); nodeList = doc.getElementsByTagName("dt"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vlang = testNode.lang; assert.equal(vlang, "en", "langLink"); }); /** * The lang attribute specifies the language code defined in RFC 1766. Retrieve the lang attribute of the NOFRAMES element and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-59132807 */ specify("HTMLElement84", () => { var success; var nodeList; var testNode; var vlang; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("element"); nodeList = doc.getElementsByTagName("noframes"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vlang = testNode.lang; assert.equal(vlang, "en", "langLink"); }); /** * The lang attribute specifies the language code defined in RFC 1766. Retrieve the lang attribute of the NOSCRIPT element and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-59132807 */ specify("HTMLElement85", () => { var success; var nodeList; var testNode; var vlang; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("element"); nodeList = doc.getElementsByTagName("noscript"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vlang = testNode.lang; assert.equal(vlang, "en", "langLink"); }); /** * The lang attribute specifies the language code defined in RFC 1766. Retrieve the lang attribute of the ADDRESS element and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-59132807 */ specify("HTMLElement86", () => { var success; var nodeList; var testNode; var vlang; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("element"); nodeList = doc.getElementsByTagName("address"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vlang = testNode.lang; assert.equal(vlang, "en", "langLink"); }); /** * The lang attribute specifies the language code defined in RFC 1766. Retrieve the lang attribute of the CENTER element and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-59132807 */ specify("HTMLElement87", () => { var success; var nodeList; var testNode; var vlang; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("element"); nodeList = doc.getElementsByTagName("center"); assert.equal(nodeList.length, 2, 'Asize'); testNode = nodeList.item(0); vlang = testNode.lang; assert.equal(vlang, "en", "langLink"); }); /** * The dir attribute specifies the base direction of directionally neutral text and the directionality of tables. Retrieve the dir attribute of the HEAD element and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-52460740 */ specify("HTMLElement88", () => { var success; var nodeList; var testNode; var vdir; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("element"); nodeList = doc.getElementsByTagName("head"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vdir = testNode.dir; assert.equal(vdir, "ltr", "dirLink"); }); /** * The dir attribute specifies the base direction of directionally neutral text and the directionality of tables. Retrieve the dir attribute of the SUB element and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-52460740 */ specify("HTMLElement89", () => { var success; var nodeList; var testNode; var vdir; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("element"); nodeList = doc.getElementsByTagName("sub"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vdir = testNode.dir; assert.equal(vdir, "ltr", "dirLink"); }); /** * The dir attribute specifies the base direction of directionally neutral text and the directionality of tables. Retrieve the dir attribute of the SUP element and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-52460740 */ specify("HTMLElement90", () => { var success; var nodeList; var testNode; var vdir; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("element"); nodeList = doc.getElementsByTagName("sup"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vdir = testNode.dir; assert.equal(vdir, "ltr", "dirLink"); }); /** * The dir attribute specifies the base direction of directionally neutral text and the directionality of tables. Retrieve the dir attribute of the SPAN element and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-52460740 */ specify("HTMLElement91", () => { var success; var nodeList; var testNode; var vdir; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("element"); nodeList = doc.getElementsByTagName("span"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vdir = testNode.dir; assert.equal(vdir, "ltr", "dirLink"); }); /** * The dir attribute specifies the base direction of directionally neutral text and the directionality of tables. Retrieve the dir attribute of the BDO element and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-52460740 */ specify("HTMLElement92", () => { var success; var nodeList; var testNode; var vdir; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("element"); nodeList = doc.getElementsByTagName("bdo"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vdir = testNode.dir; assert.equal(vdir, "ltr", "dirLink"); }); /** * The dir attribute specifies the base direction of directionally neutral text and the directionality of tables. Retrieve the dir attribute of the TT element and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-52460740 */ specify("HTMLElement93", () => { var success; var nodeList; var testNode; var vdir; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("element"); nodeList = doc.getElementsByTagName("tt"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vdir = testNode.dir; assert.equal(vdir, "ltr", "dirLink"); }); /** * The dir attribute specifies the base direction of directionally neutral text and the directionality of tables. Retrieve the dir attribute of the I element and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-52460740 */ specify("HTMLElement94", () => { var success; var nodeList; var testNode; var vdir; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("element"); nodeList = doc.getElementsByTagName("i"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vdir = testNode.dir; assert.equal(vdir, "ltr", "dirLink"); }); /** * The dir attribute specifies the base direction of directionally neutral text and the directionality of tables. Retrieve the dir attribute of the B element and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-52460740 */ specify("HTMLElement95", () => { var success; var nodeList; var testNode; var vdir; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("element"); nodeList = doc.getElementsByTagName("b"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vdir = testNode.dir; assert.equal(vdir, "ltr", "dirLink"); }); /** * The dir attribute specifies the base direction of directionally neutral text and the directionality of tables. Retrieve the dir attribute of the U element and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-52460740 */ specify("HTMLElement96", () => { var success; var nodeList; var testNode; var vdir; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("element"); nodeList = doc.getElementsByTagName("u"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vdir = testNode.dir; assert.equal(vdir, "ltr", "dirLink"); }); /** * The dir attribute specifies the base direction of directionally neutral text and the directionality of tables. Retrieve the dir attribute of the S element and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-52460740 */ specify("HTMLElement97", () => { var success; var nodeList; var testNode; var vdir; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("element"); nodeList = doc.getElementsByTagName("s"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vdir = testNode.dir; assert.equal(vdir, "ltr", "dirLink"); }); /** * The dir attribute specifies the base direction of directionally neutral text and the directionality of tables. Retrieve the dir attribute of the STRIKE element and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-52460740 */ specify("HTMLElement98", () => { var success; var nodeList; var testNode; var vdir; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("element"); nodeList = doc.getElementsByTagName("strike"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vdir = testNode.dir; assert.equal(vdir, "ltr", "dirLink"); }); /** * The dir attribute specifies the base direction of directionally neutral text and the directionality of tables. Retrieve the dir attribute of the BIG element and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-52460740 */ specify("HTMLElement99", () => { var success; var nodeList; var testNode; var vdir; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("element"); nodeList = doc.getElementsByTagName("big"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vdir = testNode.dir; assert.equal(vdir, "ltr", "dirLink"); }); /** * The form attribute returns the FORM element containing this control. Retrieve the form attribute and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-75392630 */ specify("HTMLFieldSetElement01", () => { var success; var nodeList; var testNode; var vform; var fNode; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("fieldset"); nodeList = doc.getElementsByTagName("fieldset"); assert.equal(nodeList.length, 2, 'Asize'); testNode = nodeList.item(0); fNode = testNode.form; vform = fNode.id; assert.equal(vform, "form2", "formLink"); }); /** * The form attribute returns null if control in not within the context of form. Retrieve the form attribute and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-75392630 */ specify("HTMLFieldSetElement02", () => { var success; var nodeList; var testNode; var vform; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("fieldset"); nodeList = doc.getElementsByTagName("fieldset"); assert.equal(nodeList.length, 2, 'Asize'); testNode = nodeList.item(1); vform = testNode.form; assert.equal(vform, null, 'vform should be null'); }); /** * The color attribute specifies the font's color. Retrieve the color attribute and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-53532975 */ specify("HTMLFontElement01", () => { var success; var nodeList; var testNode; var vcolor; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("font"); nodeList = doc.getElementsByTagName("font"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vcolor = testNode.color; assert.equal(vcolor, "#000000", "colorLink"); }); /** * The face attribute specifies the font's face identifier. Retrieve the face attribute and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-55715655 * @see http://www.w3.org/TR/DOM-Level-2-HTML/html#HTML-HTMLFormElement-length */ specify("HTMLFontElement02", () => { var success; var nodeList; var testNode; var vface; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("font"); nodeList = doc.getElementsByTagName("font"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vface = testNode.face; assert.equal(vface, "arial,helvetica", "faceLink"); }); /** * The size attribute specifies the font's size. Retrieve the size attribute and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-90127284 */ specify("HTMLFontElement03", () => { var success; var nodeList; var testNode; var vsize; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("font"); nodeList = doc.getElementsByTagName("font"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vsize = testNode.size; assert.equal(vsize, "4", "sizeLink"); }); /** * The elements attribute specifies a collection of all control element in the form. Retrieve the elements attribute and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-76728479 */ specify("HTMLFormElement01", () => { var success; var nodeList; var elementnodeList; var testNode; var velements; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("form"); nodeList = doc.getElementsByTagName("form"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); elementnodeList = testNode.elements; velements = elementnodeList.length; assert.equal(velements, 3, "elementsLink"); }); /** * The length attribute specifies the number of form controls in the form. Retrieve the length attribute and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-40002357 * @see http://www.w3.org/TR/DOM-Level-2-HTML/html#HTML-HTMLFormElement-length */ specify("HTMLFormElement02", () => { var success; var nodeList; var testNode; var vlength; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("form"); nodeList = doc.getElementsByTagName("form"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vlength = testNode.length; assert.equal(vlength, 3, "lengthLink"); }); /** * The id(name) attribute specifies the name of the form. Retrieve the id attribute and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-22051454 */ specify("HTMLFormElement03", () => { var success; var nodeList; var testNode; var vname; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("form"); nodeList = doc.getElementsByTagName("form"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vname = testNode.id; assert.equal(vname, "form1", "nameLink"); }); /** * The acceptCharset attribute specifies the list of character sets supported by the server. Retrieve the acceptCharset attribute and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-19661795 */ specify("HTMLFormElement04", () => { var success; var nodeList; var testNode; var vacceptcharset; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("form"); nodeList = doc.getElementsByTagName("form"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vacceptcharset = testNode.acceptCharset; assert.equal(vacceptcharset, "US-ASCII", "acceptCharsetLink"); }); /** * The enctype attribute specifies the content of the submitted form. Retrieve the enctype attribute and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-84227810 */ specify("HTMLFormElement06", () => { var success; var nodeList; var testNode; var venctype; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("form"); nodeList = doc.getElementsByTagName("form"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); venctype = testNode.enctype; assert.equal(venctype, "application/x-www-form-urlencoded", "enctypeLink"); }); /** * The method attribute specifies the HTTP method used to submit the form. Retrieve the method attribute and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-82545539 */ specify("HTMLFormElement07", () => { var success; var nodeList; var testNode; var vmethod; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("form"); nodeList = doc.getElementsByTagName("form"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vmethod = testNode.method; assert.equal(vmethod, "post", "methodLink"); }); /** * The target attribute specifies the frame to render the resource in. Retrieve the target attribute and examine it's value. * @author NIST * @author Rick Rivello * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-6512890 */ specify("HTMLFormElement08", () => { var success; var nodeList; var testNode; var vtarget; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("form2"); nodeList = doc.getElementsByTagName("form"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vtarget = testNode.target; assert.equal(vtarget, "dynamic", "targetLink"); }); /** * HTMLFormElement.reset restores the forms default values. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-76767677 */ specify("HTMLFormElement09", () => { var success; var nodeList; var testNode; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("form2"); nodeList = doc.getElementsByTagName("form"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); testNode.reset(); }); /** * The frameBorder attribute specifies the request for frame borders. (frameBorder=1 A border is drawn) (FrameBorder=0 A border is not drawn) Retrieve the frameBorder attribute of the first FRAME element and examine it's value. * @author NIST * @author Rick Rivello * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-11858633 */ specify("HTMLFrameElement01", () => { var success; var nodeList; var testNode; var vframeborder; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("frame"); nodeList = doc.getElementsByTagName("frame"); assert.equal(nodeList.length, 2, 'Asize'); testNode = nodeList.item(0); vframeborder = testNode.frameBorder; assert.equal(vframeborder, "1", "frameborderLink"); }); /** * The longDesc attribute specifies a URI designating a long description of this image or frame. Retrieve the longDesc attribute of the first FRAME element and examine its value. * @author NIST * @author Rick Rivello * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-7836998 */ specify("HTMLFrameElement02", () => { var success; var nodeList; var testNode; var vlongdesc; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("frame"); nodeList = doc.getElementsByTagName("frame"); assert.equal(nodeList.length, 2, 'Asize'); testNode = nodeList.item(0); vlongdesc = testNode.longDesc; assert.equal(vlongdesc, "about:blank", "longdescLink"); }); /** * The marginHeight attribute specifies the frame margin height, in pixels. Retrieve the marginHeight attribute of the first FRAME element and examine it's value. * @author NIST * @author Rick Rivello * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-55569778 */ specify("HTMLFrameElement03", () => { var success; var nodeList; var testNode; var vmarginheight; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("frame"); nodeList = doc.getElementsByTagName("frame"); assert.equal(nodeList.length, 2, 'Asize'); testNode = nodeList.item(0); vmarginheight = testNode.marginHeight; assert.equal(vmarginheight, "10", "marginheightLink"); }); /** * The marginWidth attribute specifies the frame margin width, in pixels. Retrieve the marginWidth attribute of the first FRAME element and examine it's value. * @author NIST * @author Rick Rivello * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-8369969 */ specify("HTMLFrameElement04", () => { var success; var nodeList; var testNode; var vmarginwidth; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("frame"); nodeList = doc.getElementsByTagName("frame"); assert.equal(nodeList.length, 2, 'Asize'); testNode = nodeList.item(0); vmarginwidth = testNode.marginWidth; assert.equal(vmarginwidth, "5", "marginwidthLink"); }); /** * The name attribute specifies the frame name(object of the target attribute). Retrieve the name attribute of the first FRAME element and examine it's value. * @author NIST * @author Rick Rivello * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-91128709 */ specify("HTMLFrameElement05", () => { var success; var nodeList; var testNode; var vname; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("frame"); nodeList = doc.getElementsByTagName("frame"); assert.equal(nodeList.length, 2, 'Asize'); testNode = nodeList.item(0); vname = testNode.name; assert.equal(vname, "Frame1", "nameLink"); }); /** * The noResize attribute specifies if the user can resize the frame. When true, forbid user from resizing frame. Retrieve the noResize attribute of the first FRAME element and examine it's value. * @author NIST * @author Rick Rivello * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-80766578 */ specify("HTMLFrameElement06", () => { var success; var nodeList; var testNode; var vnoresize; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("frame"); nodeList = doc.getElementsByTagName("frame"); assert.equal(nodeList.length, 2, 'Asize'); testNode = nodeList.item(0); vnoresize = testNode.noResize; assert.ok(vnoresize, 'noresizeLink'); }); /** * The scrolling attribute specifies whether or not the frame should have scrollbars. Retrieve the scrolling attribute of the first FRAME element and examine it's value. * @author NIST * @author Rick Rivello * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-45411424 */ specify("HTMLFrameElement07", () => { var success; var nodeList; var testNode; var vscrolling; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("frame"); nodeList = doc.getElementsByTagName("frame"); assert.equal(nodeList.length, 2, 'Asize'); testNode = nodeList.item(0); vscrolling = testNode.scrolling; assert.equal(vscrolling, "yes", "scrollingLink"); }); /** * The src attribute specifies a URI designating the initial frame contents. Retrieve the src attribute of the first FRAME element and examine it's value. * @author NIST * @author Rick Rivello * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-78799535 */ specify("HTMLFrameElement08", () => { var success; var nodeList; var testNode; var vsrc; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("frame"); nodeList = doc.getElementsByTagName("frame"); assert.equal(nodeList.length, 2, 'Asize'); testNode = nodeList.item(0); vsrc = testNode.src; assert.equal(vsrc, toFileUrl('html/files/img/right.png'), 'srcLink'); }); /** * The contentDocument attribute specifies the document this frame contains, if there is any and it is available, or null otherwise. Retrieve the contentDocument attribute of the first FRAME element and examine its TITLE value. * @author NIST * @author Rick Rivello * @see http://www.w3.org/TR/DOM-Level-2-HTML/html#ID-78799536 */ specify("HTMLFrameElement09", { async: true }, t => { var success; var testNode; var cd; var vtitle; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("frame2", { resources: "usable" }); doc.onload = function() { testNode = doc.getElementById("Frame1"); cd = testNode.contentDocument; vtitle = cd.title; // Updated as per: http://lists.w3.org/Archives/Public/www-dom/2009JulSep/0026.html assert.equal(vtitle, "NIST DOM HTML Test - FRAME", "titleLink"); t.done(); }; }); /** * The cols attribute specifies the number of columns of frames in the frameset. Retrieve the cols attribute of the first FRAMESET element and examine it's value. * @author NIST * @author Rick Rivello * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-98869594 */ specify("HTMLFrameSetElement01", () => { var success; var nodeList; var testNode; var vcols; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("frameset"); nodeList = doc.getElementsByTagName("frameset"); assert.equal(nodeList.length, 2, 'Asize'); testNode = nodeList.item(0); vcols = testNode.cols; assert.equal(vcols, "20, 80", "colsLink"); }); /** * The rows attribute specifies the number of rows of frames in the frameset. Retrieve the rows attribute of the second FRAMESET element and examine it's value. * @author NIST * @author Rick Rivello * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-19739247 */ specify("HTMLFrameSetElement02", () => { var success; var nodeList; var testNode; var vrows; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("frameset"); nodeList = doc.getElementsByTagName("frameset"); assert.equal(nodeList.length, 2, 'Asize'); testNode = nodeList.item(1); vrows = testNode.rows; assert.equal(vrows, "100, 200", "rowsLink"); }); /** * The align attribute specifies the rule alignment on the page. Retrieve the align attribute and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-15235012 */ specify("HTMLHRElement01", () => { var success; var nodeList; var testNode; var valign; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("hr"); nodeList = doc.getElementsByTagName("hr"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); valign = testNode.align; assert.equal(valign, "center", "alignLink"); }); /** * The noShade attribute specifies that the rule should be drawn as a solid color. Retrieve the noShade attribute and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-79813978 */ specify("HTMLHRElement02", () => { var success; var nodeList; var testNode; var vnoshade; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("hr"); nodeList = doc.getElementsByTagName("hr"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vnoshade = testNode.noShade; assert.ok(vnoshade, 'noShadeLink'); }); /** * The size attribute specifies the height of the rule. Retrieve the size attribute and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-77612587 */ specify("HTMLHRElement03", () => { var success; var nodeList; var testNode; var vsize; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("hr"); nodeList = doc.getElementsByTagName("hr"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vsize = testNode.size; assert.equal(vsize, "5", "sizeLink"); }); /** * The width attribute specifies the width of the rule. Retrieve the width attribute and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-87744198 */ specify("HTMLHRElement04", () => { var success; var nodeList; var testNode; var vwidth; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("hr"); nodeList = doc.getElementsByTagName("hr"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vwidth = testNode.width; assert.equal(vwidth, "400", "widthLink"); }); /** * The align attribute specifies the horizontal text alignment(H1). Retrieve the align attribute and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-6796462 */ specify("HTMLHeadingElement01", () => { var success; var nodeList; var testNode; var valign; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("heading"); nodeList = doc.getElementsByTagName("h1"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); valign = testNode.align; assert.equal(valign, "center", "alignLink"); }); /** * The align attribute specifies the horizontal text alignment(H2). Retrieve the align attribute and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-6796462 */ specify("HTMLHeadingElement02", () => { var success; var nodeList; var testNode; var valign; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("heading"); nodeList = doc.getElementsByTagName("h2"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); valign = testNode.align; assert.equal(valign, "left", "alignLink"); }); /** * The align attribute specifies the horizontal text alignment(H3). Retrieve the align attribute and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-6796462 */ specify("HTMLHeadingElement03", () => { var success; var nodeList; var testNode; var valign; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("heading"); nodeList = doc.getElementsByTagName("h3"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); valign = testNode.align; assert.equal(valign, "right", "alignLink"); }); /** * The align attribute specifies the horizontal text alignment(H4). Retrieve the align attribute and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-6796462 */ specify("HTMLHeadingElement04", () => { var success; var nodeList; var testNode; var valign; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("heading"); nodeList = doc.getElementsByTagName("h4"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); valign = testNode.align; assert.equal(valign, "justify", "alignLink"); }); /** * The align attribute specifies the horizontal text alignment(H5). Retrieve the align attribute and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-6796462 */ specify("HTMLHeadingElement05", () => { var success; var nodeList; var testNode; var valign; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("heading"); nodeList = doc.getElementsByTagName("h5"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); valign = testNode.align; assert.equal(valign, "center", "alignLink"); }); /** * The align attribute specifies the horizontal text alignment(H6). Retrieve the align attribute and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-6796462 */ specify("HTMLHeadingElement06", () => { var success; var nodeList; var testNode; var valign; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("heading"); nodeList = doc.getElementsByTagName("h6"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); valign = testNode.align; assert.equal(valign, "left", "alignLink"); }); /** * The version attribute specifies version information about the document's DTD. Retrieve the version attribute and examine its value. Test is only applicable to HTML, version attribute is not supported in XHTML. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-9383775 */ specify("HTMLHtmlElement01", () => { var nodeList; var testNode; var vversion; var doc; doc = load("html"); nodeList = doc.getElementsByTagName("html"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vversion = testNode.version; assert.equal(vversion, "-//W3C//DTD HTML 4.01 Transitional//EN", "versionLink"); }); /** * The align attribute aligns this object(vertically or horizontally with respect to its surrounding text. Retrieve the align attribute of the first IFRAME element and examine it's value. * @author NIST * @author Rick Rivello * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-11309947 */ specify("HTMLIFrameElement01", () => { var success; var nodeList; var testNode; var valign; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("iframe"); nodeList = doc.getElementsByTagName("iframe"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); valign = testNode.align; assert.equal(valign, "top", "alignLink"); }); /** * The frameBorder attribute specifies the request for frame borders. (frameBorder=1 A border is drawn) (FrameBorder=0 A border is not drawn) Retrieve the frameBorder attribute of the first IFRAME element and examine it's value. * @author NIST * @author Rick Rivello * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-22463410 */ specify("HTMLIFrameElement02", () => { var success; var nodeList; var testNode; var vframeborder; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("iframe"); nodeList = doc.getElementsByTagName("iframe"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vframeborder = testNode.frameBorder; assert.equal(vframeborder, "1", "frameborderLink"); }); /** * The height attribute specifies the frame height. Retrieve the height attribute of the first IFRAME element and examine it's value. * @author NIST * @author Rick Rivello * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-1678118 */ specify("HTMLIFrameElement03", () => { var success; var nodeList; var testNode; var vheight; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("iframe"); nodeList = doc.getElementsByTagName("iframe"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vheight = testNode.height; assert.equal(vheight, "50", "heightLink"); }); /** * The longDesc attribute specifies a URI designating a long description of this image or frame. Retrieve the longDesc attribute of the first IFRAME element and examine its value. * @author NIST * @author Rick Rivello * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-70472105 */ specify("HTMLIFrameElement04", () => { var success; var nodeList; var testNode; var vlongdesc; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("iframe"); nodeList = doc.getElementsByTagName("iframe"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vlongdesc = testNode.longDesc; assert.equal(vlongdesc, "about:blank", "longdescLink"); }); /** * The marginWidth attribute specifies the frame margin width, in pixels. Retrieve the marginWidth attribute of the first FRAME element and examine it's value. * @author NIST * @author Rick Rivello * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-66486595 */ specify("HTMLIFrameElement05", () => { var success; var nodeList; var testNode; var vmarginwidth; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("iframe"); nodeList = doc.getElementsByTagName("iframe"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vmarginwidth = testNode.marginWidth; assert.equal(vmarginwidth, "5", "marginwidthLink"); }); /** * The marginHeight attribute specifies the frame margin height, in pixels. Retrieve the marginHeight attribute of the first IFRAME element and examine it's value. * @author NIST * @author Rick Rivello * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-91371294 */ specify("HTMLIFrameElement06", () => { var success; var nodeList; var testNode; var vmarginheight; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("iframe"); nodeList = doc.getElementsByTagName("iframe"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vmarginheight = testNode.marginHeight; assert.equal(vmarginheight, "10", "marginheightLink"); }); /** * The name attribute specifies the frame name(object of the target attribute). Retrieve the name attribute of the first IFRAME element and examine it's value. * @author NIST * @author Rick Rivello * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-96819659 */ specify("HTMLIFrameElement07", () => { var success; var nodeList; var testNode; var vname; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("iframe"); nodeList = doc.getElementsByTagName("iframe"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vname = testNode.name; assert.equal(vname, "Iframe1", "nameLink"); }); /** * The scrolling attribute specifies whether or not the frame should have scrollbars. Retrieve the scrolling attribute of the first FRAME element and examine it's value. * @author NIST * @author Rick Rivello * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-36369822 */ specify("HTMLIFrameElement08", () => { var success; var nodeList; var testNode; var vscrolling; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("iframe"); nodeList = doc.getElementsByTagName("iframe"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vscrolling = testNode.scrolling; assert.equal(vscrolling, "yes", "scrollingLink"); }); /** * The src attribute specifies a URI designating the initial frame contents. Retrieve the src attribute of the first FRAME element and examine it's value. * @author NIST * @author Rick Rivello * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-43933957 */ specify("HTMLIFrameElement09", () => { var success; var nodeList; var testNode; var vsrc; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("iframe"); nodeList = doc.getElementsByTagName("iframe"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vsrc = testNode.src; assert.equal(vsrc, toFileUrl('html/files/img/right.png'), 'srcLink'); }); /** * The width attribute specifies the frame width. Retrieve the width attribute of the first IFRAME element and examine it's value. * @author NIST * @author Rick Rivello * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-67133005 */ specify("HTMLIFrameElement10", () => { var success; var nodeList; var testNode; var vwidth; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("iframe"); nodeList = doc.getElementsByTagName("iframe"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vwidth = testNode.width; assert.equal(vwidth, "60", "widthLink"); }); /** * Retrieve the contentDocument attribute of the second IFRAME element and examine its title. * @author NIST * @author Rick Rivello * @see http://www.w3.org/TR/DOM-Level-2-HTML/html#ID-67133006 */ specify("HTMLIFrameElement11", { async: true }, t => { var success; var testNode; var cd; var vtitle; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("iframe2", { resources: "usable" }); doc.onload = function() { testNode = doc.getElementById("Iframe2"); cd = testNode.contentDocument; vtitle = cd.title; assert.equal(vtitle, "NIST DOM HTML Test - FRAME", "titleLink"); t.done(); }; }); /** * The name attribute specifies the name of the element. Retrieve the name attribute and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-47534097 */ specify("HTMLImageElement01", () => { var success; var nodeList; var testNode; var vname; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("img"); nodeList = doc.getElementsByTagName("img"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vname = testNode.name; assert.equal(vname, "IMAGE-1", "nameLink"); }); /** * The align attribute aligns this object with respect to its surrounding text. Retrieve the align attribute and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-3211094 */ specify("HTMLImageElement02", () => { var success; var nodeList; var testNode; var valign; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("img"); nodeList = doc.getElementsByTagName("img"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); valign = testNode.align; assert.equal(valign, "middle", "alignLink"); }); /** * The alt attribute specifies an alternative text for user agenst not rendering the normal content of this element. Retrieve the alt attribute and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-95636861 */ specify("HTMLImageElement03", () => { var success; var nodeList; var testNode; var valt; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("img"); nodeList = doc.getElementsByTagName("img"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); valt = testNode.alt; assert.equal(valt, "DTS IMAGE LOGO", "altLink"); }); /** * The border attribute specifies the width of the border around the image. Retrieve the border attribute and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-136671 */ specify("HTMLImageElement04", () => { var success; var nodeList; var testNode; var vborder; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("img"); nodeList = doc.getElementsByTagName("img"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vborder = testNode.border; assert.equal(vborder, "0", "borderLink"); }); /** * The height attribute overrides the natural "height" of the image. Retrieve the height attribute and examine it's value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/DOM-Level-2-HTML/html#ID-91561496 */ specify("HTMLImageElement05", () => { var success; var nodeList; var testNode; var vheight; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("img"); nodeList = doc.getElementsByTagName("img"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vheight = testNode.height; assert.equal(vheight, 47, "heightLink"); }); /** * The hspace attribute specifies the horizontal space to the left and right of this image. Retrieve the hspace attribute and examine it's value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/DOM-Level-2-HTML/html#ID-53675471 */ specify("HTMLImageElement06", () => { var success; var nodeList; var testNode; var vhspace; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("img"); nodeList = doc.getElementsByTagName("img"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vhspace = testNode.hspace; assert.equal(vhspace, 4, "hspaceLink"); }); /** * The isMap attribute indicates the use of server-side image map. Retrieve the isMap attribute and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-58983880 */ specify("HTMLImageElement07", () => { var success; var nodeList; var testNode; var vismap; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("img"); nodeList = doc.getElementsByTagName("img"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vismap = testNode.isMap; assert.equal(vismap, false, 'vismap should be *false*'); }); /** * The src attribute contains an URI designating the source of this image. Retrieve the src attribute and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-87762984 */ specify("HTMLImageElement09", () => { var success; var nodeList; var testNode; var vsrc; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("img"); nodeList = doc.getElementsByTagName("img"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vsrc = testNode.src; assert.equal(vsrc, toFileUrl('html/files/pix/dts.gif'), 'srcLink'); }); /** * The useMap attribute specifies to use the client-side image map. Retrieve the useMap attribute and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-35981181 */ specify("HTMLImageElement10", () => { var success; var nodeList; var testNode; var vusemap; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("img"); nodeList = doc.getElementsByTagName("img"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vusemap = testNode.useMap; assert.equal(vusemap, "#DTS-MAP", "useMapLink"); }); /** * The vspace attribute specifies the vertical space above and below this image. Retrieve the vspace attribute and examine it's value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/DOM-Level-2-HTML/html#ID-85374897 */ specify("HTMLImageElement11", () => { var success; var nodeList; var testNode; var vvspace; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("img"); nodeList = doc.getElementsByTagName("img"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vvspace = testNode.vspace; assert.equal(vvspace, 10, "vspaceLink"); }); /** * The width attribute overrides the natural "width" of the image. Retrieve the width attribute and examine it's value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/DOM-Level-2-HTML/html#ID-13839076 */ specify("HTMLImageElement12", () => { var success; var nodeList; var testNode; var vwidth; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("img"); nodeList = doc.getElementsByTagName("img"); assert.equal(nodeList.length, 1, 'Asize'); testNode = nodeList.item(0); vwidth = testNode.width; assert.equal(vwidth, 115, "widthLink"); }); /** * The defaultValue attribute represents the HTML value of the attribute when the type attribute has the value of "Text", "File" or "Password". Retrieve the defaultValue attribute of the 1st INPUT element and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-26091157 */ specify("HTMLInputElement01", () => { var success; var nodeList; var testNode; var vdefaultvalue; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("input"); nodeList = doc.getElementsByTagName("input"); assert.equal(nodeList.length, 9, 'Asize'); testNode = nodeList.item(0); vdefaultvalue = testNode.defaultValue; assert.equal(vdefaultvalue, "Password", "defaultValueLink"); }); /** * The defaultChecked attribute represents the HTML checked attribute of the element when the type attribute has the value checkbox or radio. Retrieve the defaultValue attribute of the 4th INPUT element and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-20509171 */ specify("HTMLInputElement02", () => { var success; var nodeList; var testNode; var vdefaultchecked; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("input"); nodeList = doc.getElementsByTagName("input"); assert.equal(nodeList.length, 9, 'Asize'); testNode = nodeList.item(3); vdefaultchecked = testNode.defaultChecked; assert.ok(vdefaultchecked, 'defaultCheckedLink'); }); /** * The form attribute returns the FORM element containing this control. Retrieve the form attribute of the 1st INPUT element and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-63239895 */ specify("HTMLInputElement03", () => { var success; var nodeList; var testNode; var vform; var fNode; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("input"); nodeList = doc.getElementsByTagName("input"); assert.equal(nodeList.length, 9, 'Asize'); testNode = nodeList.item(0); fNode = testNode.form; vform = fNode.id; assert.equal(vform, "form1", "formLink"); }); /** * The accept attribute is a comma-seperated list of content types that a server processing this form will handle correctly. Retrieve the accept attribute of the 9th INPUT element and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-15328520 */ specify("HTMLInputElement04", () => { var success; var nodeList; var testNode; var vaccept; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("input"); nodeList = doc.getElementsByTagName("input"); assert.equal(nodeList.length, 9, 'Asize'); testNode = nodeList.item(8); vaccept = testNode.accept; assert.equal(vaccept, 'GIF,JPEG', 'acceptLink'); }); /** * The accessKey attribute is a single character access key to give access to the form control. Retrieve the accessKey attribute of the 2nd INPUT element and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-59914154 */ specify("HTMLInputElement05", () => { var success; var nodeList; var testNode; var vaccesskey; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("input"); nodeList = doc.getElementsByTagName("input"); assert.equal(nodeList.length, 9, 'Asize'); testNode = nodeList.item(1); vaccesskey = testNode.accessKey; assert.equal(vaccesskey, "c", "accesskeyLink"); }); /** * The align attribute aligns this object(vertically or horizontally) with respect to the surrounding text. Retrieve the align attribute of the 4th INPUT element and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-96991182 */ specify("HTMLInputElement06", () => { var success; var nodeList; var testNode; var valign; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("input"); nodeList = doc.getElementsByTagName("input"); assert.equal(nodeList.length, 9, 'Asize'); testNode = nodeList.item(3); valign = testNode.align; assert.equal(valign.toLowerCase(), "bottom".toLowerCase(), "alignLink"); }); /** * The alt attribute alternates text for user agents not rendering the normal content of this element. Retrieve the alt attribute of the 1st INPUT element and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-92701314 */ specify("HTMLInputElement07", () => { var success; var nodeList; var testNode; var valt; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("input"); nodeList = doc.getElementsByTagName("input"); assert.equal(nodeList.length, 9, 'Asize'); testNode = nodeList.item(0); valt = testNode.alt; assert.equal(valt, "Password entry", "altLink"); }); /** * The checked attribute represents the current state of the corresponding form control when type has the value Radio or Checkbox. Retrieve the accept attribute of the 3rd INPUT element and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-30233917 */ specify("HTMLInputElement08", () => { var success; var nodeList; var testNode; var vchecked; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("input"); nodeList = doc.getElementsByTagName("input"); assert.equal(nodeList.length, 9, 'Asize'); testNode = nodeList.item(2); vchecked = testNode.checked; assert.ok(vchecked, 'checkedLink'); }); /** * The disabled attribute has a TRUE value if it is explicitly set. Retrieve the disabled attribute of the 7th INPUT element and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-50886781 */ specify("HTMLInputElement09", () => { var success; var nodeList; var testNode; var vdisabled; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("input"); nodeList = doc.getElementsByTagName("input"); assert.equal(nodeList.length, 9, 'Asize'); testNode = nodeList.item(6); vdisabled = testNode.disabled; assert.ok(vdisabled, 'disabledLink'); }); /** * The maxLength attribute is the maximum number of text characters for text fields, when type has the value of Text or Password. Retrieve the maxLenght attribute of the 1st INPUT element and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-54719353 */ specify("HTMLInputElement10", () => { var success; var nodeList; var testNode; var vmaxlength; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("input"); nodeList = doc.getElementsByTagName("input"); assert.equal(nodeList.length, 9, 'Asize'); testNode = nodeList.item(0); vmaxlength = testNode.maxLength; assert.equal(vmaxlength, 5, "maxlengthLink"); }); /** * The name attribute is the form control or object name when submitted with a form. Retrieve the name attribute of the 1st INPUT element and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-89658498 */ specify("HTMLInputElement11", () => { var success; var nodeList; var testNode; var vname; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("input"); nodeList = doc.getElementsByTagName("input"); assert.equal(nodeList.length, 9, 'Asize'); testNode = nodeList.item(0); vname = testNode.name; assert.equal(vname, "Password", "nameLink"); }); /** * The readOnly attribute indicates that this control is read-only when type has a value of text or password only. Retrieve the readOnly attribute of the 1st INPUT element and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-88461592 */ specify("HTMLInputElement12", () => { var success; var nodeList; var testNode; var vreadonly; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("input"); nodeList = doc.getElementsByTagName("input"); assert.equal(nodeList.length, 9, 'Asize'); testNode = nodeList.item(0); vreadonly = testNode.readOnly; assert.ok(vreadonly, 'readonlyLink'); }); /** * The size attribute contains the size information. Its precise meaning is specific to each type of field. Retrieve the size attribute of the 1st INPUT element and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/DOM-Level-2-HTML/html#ID-79659438 */ specify("HTMLInputElement13", () => { var success; var nodeList; var testNode; var vsize; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("input"); nodeList = doc.getElementsByTagName("input"); assert.equal(nodeList.length, 9, 'Asize'); testNode = nodeList.item(0); vsize = testNode.size; assert.equal(vsize, 25, "size"); }); /** * The src attribute specifies the location of the image to decorate the graphical submit button when the type has the value Image. Retrieve the src attribute of the 8th INPUT element and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-97320704 */ specify("HTMLInputElement14", () => { var success; var nodeList; var testNode; var vsrc; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("input"); nodeList = doc.getElementsByTagName("input"); assert.equal(nodeList.length, 9, 'Asize'); testNode = nodeList.item(7); vsrc = testNode.src; assert.isTrue(vsrc.endsWith('/pix/submit.gif'), 'srcLink'); }); /** * The tabIndex attribute is an index that represents the elements position in the tabbing order. Retrieve the tabIndex attribute of the 3rd INPUT element and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-62176355 */ specify("HTMLInputElement15", () => { var success; var nodeList; var testNode; var vtabindex; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("input"); nodeList = doc.getElementsByTagName("input"); assert.equal(nodeList.length, 9, 'Asize'); testNode = nodeList.item(2); vtabindex = testNode.tabIndex; assert.equal(vtabindex, 9, "tabindexLink"); }); /** * The type attribute is the type of control created. Retrieve the type attribute of the 1st INPUT element and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-62883744 */ specify("HTMLInputElement16", () => { var success; var nodeList; var testNode; var vtype; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("input"); nodeList = doc.getElementsByTagName("input"); assert.equal(nodeList.length, 9, 'Asize'); testNode = nodeList.item(0); vtype = testNode.type; assert.equal(vtype, "password", "typeLink"); }); /** * The useMap attribute specifies the use of the client-side image map. Retrieve the useMap attribute of the 8th INPUT element and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-32463706 */ specify("HTMLInputElement17", () => { var success; var nodeList; var testNode; var vusemap; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("input"); nodeList = doc.getElementsByTagName("input"); assert.equal(nodeList.length, 9, 'Asize'); testNode = nodeList.item(7); vusemap = testNode.useMap; assert.equal(vusemap, "#submit-map", "usemapLink"); }); /** * The value attribute is the current content of the corresponding form control when the type attribute has the value Text, File or Password. Retrieve the value attribute of the 2nd INPUT element and examine its value. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-49531485 */ specify("HTMLInputElement18", () => { var success; var nodeList; var testNode; var vvalue; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("input"); nodeList = doc.getElementsByTagName("input"); assert.equal(nodeList.length, 9, 'Asize'); testNode = nodeList.item(1); vvalue = testNode.value; assert.equal(vvalue, "ReHire", "valueLink"); }); /** * HTMLInputElement.blur should surrender input focus. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-26838235 */ specify("HTMLInputElement19", () => { var success; var nodeList; var testNode; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("input"); nodeList = doc.getElementsByTagName("input"); assert.equal(nodeList.length, 9, 'Asize'); testNode = nodeList.item(1); testNode.blur(); }); /** * HTMLInputElement.focus should capture input focus. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-65996295 */ specify("HTMLInputElement20", () => { var success; var nodeList; var testNode; var doc; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("input"); nodeList = doc.getElementsByTagName("input"); assert.equal(nodeList.length, 9, 'Asize'); testNode = nodeList.item(1); testNode.focus(); }); /** * HTMLInputElement.click should change the state of checked on a radio button. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-2651361 */ specify("HTMLInputElement21", () => { var success; var nodeList; var testNode; var doc; var checked; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("input"); nodeList = doc.getElementsByTagName("input"); assert.equal(nodeList.length, 9, 'Asize'); testNode = nodeList.item(1); checked = testNode.checked; assert.equal(checked, false, 'checked should be *false*'); testNode.click(); checked = testNode.checked; assert.ok(checked, 'checkedAfterClick'); }); /** * HTMLInputElement.select should select the contents of a text area. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-34677168 */ specify("HTMLInputElement22", () => { var success; var nodeList; var testNode; var doc; var checked; var docRef = null; if (typeof(this.doc) != 'undefined') { docRef = this.doc; } doc = load("input"); nodeList = doc.getElementsByTagName("input"); assert.equal(nodeList.length, 9, 'Asize'); testNode = nodeList.item(0); testNode.select(); }); specify("HTMLInputElementCheckboxClickTogglesCheckedState", () => { var doc = load("input"); var element = doc.querySelector("input[name='Check1']"); assert.equal(element.checked, true); element.click(); assert.equal(element.checked, false); element.click(); assert.equal(element.checked, true); }); specify("HTMLInputElementDefaultEventClickForCheckboxTogglesCheckedState", () => { var doc = load("input"); var element = doc.querySelector("input[name='Check1']"); var clickevent = doc.createEvent("MouseEvent"); clickevent.initEvent("click", true, true); element.dispatchEvent(clickevent); assert.equal(element.checked, false); element.dispatchEvent(clickevent); assert.equal(element.checked, true); element.dispatchEvent(clickevent); assert.equal(element.checked, false); }); // tests removed because it's replaced by
jsdom-19.0.0/test/to-port-to-wpts/level2/html/files/collection.html000066400000000000000000000041751415223704400252040ustar00rootroot00000000000000 NIST DOM HTML Test - SELECT
Table Caption
Employee Id Employee Name Position Salary Gender Address
next page ... next page ... next page ... next page ... next page ... next page ...
EMP0001 Margaret Martin Accountant 56,000 Female 1230 North Ave. Dallas, Texas 98551
EMP0002 Martha Raynolds Secretary 35,000 Female 1900 Dallas Road Dallas, Texas 98554

jsdom-19.0.0/test/to-port-to-wpts/level2/html/files/directory.html000066400000000000000000000005611415223704400250500ustar00rootroot00000000000000 NIST DOM HTML Test - Directory
  • DIR item number 1.
  • DIR item number 2.
  • DIR item number 3.
  • jsdom-19.0.0/test/to-port-to-wpts/level2/html/files/div.html000066400000000000000000000005371415223704400236310ustar00rootroot00000000000000 NIST DOM HTML Test - DIV
    The DIV element is a generic block container. This text should be centered.
    jsdom-19.0.0/test/to-port-to-wpts/level2/html/files/dl.html000066400000000000000000000005651415223704400234470ustar00rootroot00000000000000 NIST DOM HTML Test - DL
    Accountant
    56,000
    Female
    1230 North Ave. Dallas, Texas 98551
    jsdom-19.0.0/test/to-port-to-wpts/level2/html/files/document.html000066400000000000000000000027511415223704400246650ustar00rootroot00000000000000 NIST DOM HTML Test - DOCUMENT

    Domain Domain

    DTS IMAGE LOGO

    View Submit Button

    jsdom-19.0.0/test/to-port-to-wpts/level2/html/files/element.html000066400000000000000000000070551415223704400245020ustar00rootroot00000000000000 NIST DOM HTML Test - Element

    Test Lists


    1. EMP0001
      • Margaret Martin
        Accountant
        56,000
        Female
        1230 North Ave. Dallas, Texas 98551

    Bold
    DT element

    Bidirectional algorithm overide
    Italicized

    Teletype
    Subscript
    SuperScript
    Strike Through (S)
    Strike Through (STRIKE)
    Small
    Big
    Emphasis
    Strong
    10 Computer Code Fragment 20 Temp = 10 Temp = 20 *2 Temp Citation
    Temp
    NIST
    Gaithersburg, MD 20899

    Not

    Underlined jsdom-19.0.0/test/to-port-to-wpts/level2/html/files/fieldset.html000066400000000000000000000007711415223704400246460ustar00rootroot00000000000000 NIST DOM HTML Test - FieldSet
    All data entered must be valid
    All data entered must be valid
    jsdom-19.0.0/test/to-port-to-wpts/level2/html/files/font.html000066400000000000000000000005021415223704400240050ustar00rootroot00000000000000 NIST DOM HTML Test - Font Test Tables jsdom-19.0.0/test/to-port-to-wpts/level2/html/files/form.html000066400000000000000000000010401415223704400240000ustar00rootroot00000000000000 NIST DOM HTML Test - FORM

    jsdom-19.0.0/test/to-port-to-wpts/level2/html/files/form2.html000066400000000000000000000011451415223704400240700ustar00rootroot00000000000000 NIST DOM HTML Test - FORM

    jsdom-19.0.0/test/to-port-to-wpts/level2/html/files/form3.html000066400000000000000000000006611415223704400240730ustar00rootroot00000000000000 FORM3

    jsdom-19.0.0/test/to-port-to-wpts/level2/html/files/frame.html000066400000000000000000000010311415223704400241270ustar00rootroot00000000000000 NIST DOM HTML Test - FRAME jsdom-19.0.0/test/to-port-to-wpts/level2/html/files/frame2.html000066400000000000000000000010601415223704400242130ustar00rootroot00000000000000 NIST DOM HTML Test - FRAME2 jsdom-19.0.0/test/to-port-to-wpts/level2/html/files/frameset.html000066400000000000000000000006401415223704400246500ustar00rootroot00000000000000 NIST DOM HTML Test - FRAMESET jsdom-19.0.0/test/to-port-to-wpts/level2/html/files/head.html000066400000000000000000000004561415223704400237500ustar00rootroot00000000000000 NIST DOM HTML Test - HEAD

    Hello, World.

    jsdom-19.0.0/test/to-port-to-wpts/level2/html/files/heading.html000066400000000000000000000007431415223704400244450ustar00rootroot00000000000000 NIST DOM HTML Test - HEADING

    Head Element 1

    Head Element 2

    Head Element 3

    Head Element 4

    Head Element 5
    Head Element 6
    jsdom-19.0.0/test/to-port-to-wpts/level2/html/files/hr.html000066400000000000000000000004651415223704400234600ustar00rootroot00000000000000 NIST DOM HTML Test - HR
    jsdom-19.0.0/test/to-port-to-wpts/level2/html/files/html.html000066400000000000000000000005011415223704400240020ustar00rootroot00000000000000 NIST DOM HTML Test - Html

    Hello, World.

    jsdom-19.0.0/test/to-port-to-wpts/level2/html/files/iframe.html000066400000000000000000000006661415223704400243150ustar00rootroot00000000000000 NIST DOM HTML Test - IFRAME jsdom-19.0.0/test/to-port-to-wpts/level2/html/files/iframe2.html000066400000000000000000000007631415223704400243750ustar00rootroot00000000000000 NIST DOM HTML Test - IFRAME2 jsdom-19.0.0/test/to-port-to-wpts/level2/html/files/img.html000066400000000000000000000007061415223704400236210ustar00rootroot00000000000000 NIST DOM HTML Test - IMG

    DTS IMAGE LOGO

    jsdom-19.0.0/test/to-port-to-wpts/level2/html/files/img/000077500000000000000000000000001415223704400227305ustar00rootroot00000000000000jsdom-19.0.0/test/to-port-to-wpts/level2/html/files/img/right.png000066400000000000000000000000001415223704400245410ustar00rootroot00000000000000jsdom-19.0.0/test/to-port-to-wpts/level2/html/files/img/w3c_main.png000066400000000000000000000000001415223704400251240ustar00rootroot00000000000000jsdom-19.0.0/test/to-port-to-wpts/level2/html/files/input.html000066400000000000000000000033061415223704400242030ustar00rootroot00000000000000 NIST DOM HTML Test - INPUT
    Under a FORM control
    ReHire
    NewHire
    Hours available to work EarlyMornings
    Afternoon
    Evenings
    Closing
    jsdom-19.0.0/test/to-port-to-wpts/level2/html/files/isindex.html000066400000000000000000000006051415223704400245060ustar00rootroot00000000000000 NIST DOM HTML Test - ISINDEX
    jsdom-19.0.0/test/to-port-to-wpts/level2/html/files/js/000077500000000000000000000000001415223704400225705ustar00rootroot00000000000000jsdom-19.0.0/test/to-port-to-wpts/level2/html/files/js/script with spaces.js000066400000000000000000000000001415223704400266130ustar00rootroot00000000000000jsdom-19.0.0/test/to-port-to-wpts/level2/html/files/js/script1.js000066400000000000000000000000001415223704400245010ustar00rootroot00000000000000jsdom-19.0.0/test/to-port-to-wpts/level2/html/files/label.html000066400000000000000000000010741415223704400241230ustar00rootroot00000000000000 NIST DOM HTML Test - LABEL

    jsdom-19.0.0/test/to-port-to-wpts/level2/html/files/legend.html000066400000000000000000000011271415223704400243010ustar00rootroot00000000000000 NIST DOM HTML Test - LEGEND
    Enter Password1:
    Enter Password2:
    jsdom-19.0.0/test/to-port-to-wpts/level2/html/files/li.html000066400000000000000000000006211415223704400234450ustar00rootroot00000000000000 NIST DOM HTML Test - LI
    1. EMP0001
      • Margaret Martin
        Accountant
        56,000
        Female
    jsdom-19.0.0/test/to-port-to-wpts/level2/html/files/link.html000066400000000000000000000007541415223704400240050ustar00rootroot00000000000000 NIST DOM HTML Test - LINK


    jsdom-19.0.0/test/to-port-to-wpts/level2/html/files/link2.html000066400000000000000000000010441415223704400240600ustar00rootroot00000000000000 NIST DOM HTML Test - LINK


    jsdom-19.0.0/test/to-port-to-wpts/level2/html/files/map.html000066400000000000000000000007371415223704400236260ustar00rootroot00000000000000 NIST DOM HTML Test - MAP

    Domain1 Domain2 Domain3

    jsdom-19.0.0/test/to-port-to-wpts/level2/html/files/menu.html000066400000000000000000000005321415223704400240060ustar00rootroot00000000000000 NIST DOM HTML Test - MENU
  • Interview
  • Paperwork
  • Give start date
  • jsdom-19.0.0/test/to-port-to-wpts/level2/html/files/meta.html000066400000000000000000000004331415223704400237700ustar00rootroot00000000000000 NIST DOM HTML Test - META


    jsdom-19.0.0/test/to-port-to-wpts/level2/html/files/mod.html000066400000000000000000000010561415223704400236230ustar00rootroot00000000000000 NIST DOM HTML Test - MOD

    The INS element is used to indicate that a section of a document had been inserted.
    The DEL element is used to indicate that a section of a document had been removed.

    jsdom-19.0.0/test/to-port-to-wpts/level2/html/files/object.html000066400000000000000000000012551415223704400243130ustar00rootroot00000000000000 NIST DOM HTML Test - OBJECT

    jsdom-19.0.0/test/to-port-to-wpts/level2/html/files/object2.html000066400000000000000000000012101415223704400243640ustar00rootroot00000000000000 NIST DOM HTML Test - OBJECT

    jsdom-19.0.0/test/to-port-to-wpts/level2/html/files/olist.html000066400000000000000000000007661415223704400242050ustar00rootroot00000000000000 NIST DOM HTML Test - OLIST
    1. EMP0001
      • Margaret Martin
        Accountant
        56,000
    2. EMP0002
      • Martha Raynolds
        Secretary
        35,000
    jsdom-19.0.0/test/to-port-to-wpts/level2/html/files/optgroup.html000066400000000000000000000011131415223704400247150ustar00rootroot00000000000000 NIST DOM HTML Test - OPTGROUP

    jsdom-19.0.0/test/to-port-to-wpts/level2/html/files/option.html000066400000000000000000000015041415223704400243520ustar00rootroot00000000000000 NIST DOM HTML Test - OPTION

    jsdom-19.0.0/test/to-port-to-wpts/level2/html/files/optionscollection.html000066400000000000000000000015171415223704400266150ustar00rootroot00000000000000 NIST DOM HTML Test - OPTIONSCOLLECTION

    jsdom-19.0.0/test/to-port-to-wpts/level2/html/files/paragraph.html000066400000000000000000000004341415223704400250100ustar00rootroot00000000000000 NIST DOM HTML Test - PARAGRAPH

    TEXT

    jsdom-19.0.0/test/to-port-to-wpts/level2/html/files/param.html000066400000000000000000000005271415223704400241460ustar00rootroot00000000000000 NIST DOM HTML Test - PARAM

    jsdom-19.0.0/test/to-port-to-wpts/level2/html/files/pre.html000066400000000000000000000010451415223704400236300ustar00rootroot00000000000000 NIST DOM HTML Test - PRE
    The PRE is used to indicate pre-formatted text.  Visual agents may:
    
                    leave white space intact.
                    May render text with a fixed-pitch font.
                    May disable automatic word wrap.
                    Must not disable bidirectional processing.
    
    jsdom-19.0.0/test/to-port-to-wpts/level2/html/files/quote.html000066400000000000000000000006701415223704400242020ustar00rootroot00000000000000 NIST DOM HTML Test - QUOTE

    The Q element is intended for short quotations

    The BLOCKQUOTE element is used for long quotations.

    jsdom-19.0.0/test/to-port-to-wpts/level2/html/files/right.png000066400000000000000000000002111415223704400237710ustar00rootroot00000000000000PNG  IHDR 5gAMAܲPLTEP.IDATx1 ~PPFmO//>EIENDB`jsdom-19.0.0/test/to-port-to-wpts/level2/html/files/script.html000066400000000000000000000005441415223704400243510ustar00rootroot00000000000000 NIST DOM HTML Test - SCRIPT jsdom-19.0.0/test/to-port-to-wpts/level2/html/files/scriptinline.html000066400000000000000000000006001415223704400255410ustar00rootroot00000000000000 JSDom Document.write Regression Test

    Hello World

    jsdom-19.0.0/test/to-port-to-wpts/level2/html/files/select.html000066400000000000000000000017201415223704400243210ustar00rootroot00000000000000 NIST DOM HTML Test - SELECT

    jsdom-19.0.0/test/to-port-to-wpts/level2/html/files/style.html000066400000000000000000000004771415223704400242120ustar00rootroot00000000000000 NIST DOM HTML Test - STYLE

    Hello, World.

    jsdom-19.0.0/test/to-port-to-wpts/level2/html/files/table.html000066400000000000000000000035671415223704400241440ustar00rootroot00000000000000 NIST DOM HTML Test - TABLE
    Id Name Position Salary
    Table Caption
    Employee Id Employee Name Position Salary Gender Address
    next page ... next page ... next page ... next page ... next page ... next page ...
    EMP0001 Margaret Martin Accountant 56,000 Female 1230 North Ave. Dallas, Texas 98551
    EMP0002 Martha Raynolds Secretary 35,000 Female 1900 Dallas Road Dallas, Texas 98554
    jsdom-19.0.0/test/to-port-to-wpts/level2/html/files/table1.html000066400000000000000000000005201415223704400242070ustar00rootroot00000000000000 NIST DOM HTML Test - TABLE
    HTML can't abide empty table
    jsdom-19.0.0/test/to-port-to-wpts/level2/html/files/tablecaption.html000066400000000000000000000006631415223704400255140ustar00rootroot00000000000000 NIST DOM HTML Test - TABLECAPTION
    CAPTION 1
    Employee Id Employee Name Position Salary
    jsdom-19.0.0/test/to-port-to-wpts/level2/html/files/tablecell.html000066400000000000000000000016151415223704400247740ustar00rootroot00000000000000 NIST DOM HTML Test - TABLECELL
    Employee Id Employee Name Position Salary
    EMP0001 Margaret Martin Accountant 56,000
    jsdom-19.0.0/test/to-port-to-wpts/level2/html/files/tablecol.html000066400000000000000000000011651415223704400246320ustar00rootroot00000000000000 NIST DOM HTML Test - TABLECOL
    Id Name Position Salary
    EMP0001 Martin Accountant 56,000
    jsdom-19.0.0/test/to-port-to-wpts/level2/html/files/tablerow.html000066400000000000000000000033701415223704400246640ustar00rootroot00000000000000 NIST DOM HTML Test - TABLEROW
    Id Name Position Salary
    Table Caption
    Employee Id Employee Name Position Salary Gender Address
    next page ... next page ... next page ... next page ... next page ... next page ...
    EMP0001 Margaret Martin Accountant 56,000 Female 1230 North Ave. Dallas, Texas 98551
    EMP0002 Martha Raynolds Secretary 35,000 Female 1900 Dallas Road Dallas, Texas 98554
    jsdom-19.0.0/test/to-port-to-wpts/level2/html/files/tablesection.html000066400000000000000000000035151415223704400255220ustar00rootroot00000000000000 NIST DOM HTML Test - TABLESECTION
    Id Name Position Salary
    Table Caption
    Employee Id Employee Name Position Salary Gender Address
    next page ... next page ... next page ... next page ... next page ... next page ...
    EMP0001 Margaret Martin Accountant 56,000 Female 1230 North Ave. Dallas, Texas 98551
    EMP0002 Martha Raynolds Secretary 35,000 Female 1900 Dallas Road Dallas, Texas 98554
    jsdom-19.0.0/test/to-port-to-wpts/level2/html/files/textarea.html000066400000000000000000000016521415223704400246630ustar00rootroot00000000000000 NIST DOM HTML Test - TEXTAREA

    jsdom-19.0.0/test/to-port-to-wpts/level2/html/files/title.html000066400000000000000000000004121415223704400241600ustar00rootroot00000000000000 NIST DOM HTML Test - TITLE


    jsdom-19.0.0/test/to-port-to-wpts/level2/html/files/ulist.html000066400000000000000000000011531415223704400242020ustar00rootroot00000000000000 NIST DOM HTML Test - ULIST
    1. EMP0001
      • Margaret Martin
        Accountant
        56,000
        Female
        1230 North Ave. Dallas, Texas 98551
    2. EMP0002
      • Martha Raynolds
        Secretary
        35,000
        Female
        1900 Dallas Road. Dallas, Texas 98554
    jsdom-19.0.0/test/to-port-to-wpts/level2/html/files/w3c_main.png000066400000000000000000000134201415223704400243620ustar00rootroot00000000000000PNG  IHDR;0Y-gAMABO cHRMnth$m_l<X; PLTE!!!)))111999BBBJJJRRRZZZccckkksss{{{{ssskkkccZRR1))ƽsskkkcccZ!)!19޽眽֔{ƄskcJsZRB{9s)k!cZޭRJ祽֔֌΄sBZskc9RkZ!1BRJ{Bs9s1k)c!ZZRJ!B)R1cBZ9k)c!ZRJ9{B{sskcJkR{BsJB)Zޜ֔ΌBZ{1c1s9kc1{91!1){MIDATxbpqKLra 7oT`ƀnHjddl1Y!zBnn$-:>di.0 Bi$#*Ms4 Rv$NH :N0&)d,1z~@@1 ! ) Q [4o py,慁LfM/4X $ɮ*/2 f⧧'CHng8k'(x 1`g@(w&A%nY\ĀV^d5!*;PTª3l'〆cai!`iKAT ɠ3ʓ0 $d; GWBn(-XM 6At6E ̖(de䐓%Q)-3EIC(%v"I%f7 0?$LVsђ7/H3q B@R0pv Fa iJ0BY@P jBDSUz\`F:( z\Ɋ"kY􀑚nɱ@$#R&,VPX b,, 5KY5K8Bv Ο δ!p`ĿƵ#f.x&l45XCxk8$`CAz-81jx^6 4O@@Q A lG0-BӀ!l>fpg\ET?_LrsM`Ҭ!Ҙ YPN2ܐj,X] ɀrf0S DXa5[ 01M X!I]H (JAdrp[?78uЅUt[jaD8^ Ih@ R  f.X9k' eej`ر""d&`hqA $X#bc9g1rrrrpbV,,h$ D@&U{#'@`E,9JKr nxVnEõ` `P/h@@Mg4o09I͂ I@ZDP`N(* 1 ˀ&\Hc: Qp$ Ao3i),yg@_Lj@y DXhIOY̲ } v@*@!,0ɰbx)?+.9yV l*$;% 0aH?+\ZM@i0CC]hP. 0HHΨo 68 !4`؁Z R1",)Z!!PN(@Iw`v HO$oDNb%\V8HL3 *4''bDu"A Yl֘,I.HQ̳0=݁›PPxIb&Y9 XlL&(ŀ!(TAl&,e:@Ar\sxeLkn@l,, W$8YB v h8L0KU`H S, hTϊC1W= nJF99 .z#Y1 n%Cڢt3 J;-x=+&iY"]\ Bj6XqRJA3쀍3A`i l#D;.,@ -s0P70E m|Y բYfaa^̄@PZ!P׵ԲDAu6 ( ai<?#9:CYȈHw`R%L@? ba шZށ +8v`cTEQV F4 03X(6r"Y\+1~ v(~ft< cw2P~Ȑ$ֳ@ T&P䀚F9+Z"D7Ԗ@|BNЬ8 F; H8 Q$ }' !zFb 0`톢;.h ;p!%0ZO 1 \+` օW1ivQ ˅vt>&15Qmm;P;$Ā88g};Q lj^]8Pe1zeCuG,˚@{f3 Y6iP|SC-Gܐi`C]N4l,|iI1Ar-0Lj#r9HIeY6Hks?0hui0Q R\ U\_N:JMs@q" <BZP߁(dY&X2ȫLh 6 :h߁CE fYM@(6ABiP,CFe]8= Mv~hz2G2:o%ǧ < FjB8̔g Pn-bF@J:0uBF@ @*Vfbaa0gZtdPgGbF8 EBt;;KǟQ_)R~]t/MqwLp)4FOYqLYmzv¡TP+S_"d$sc|?:v\]Ӆ."gKy{8ӳؑUM%Mv|'sAMb-@fP=ʹ$ Lfu@i'&"䔀l&80ݍ%] KGG y:+0k+EAIq,/DP6"TPZ\ Q(*KKQ+vG#J iA 6m k{ac rP@ J#8Hp+Ǣ tFzi)N7@q iB pm'TunL f?#nԉ/tP#soAGQ)M4&_s tW :E-+…"@! ,jl!vi5pl炃 fdx\ \ ~ @nF(Cj)\ K! sY HK:Au5;B 0NM6B$#&.77>(.6.=DwwʰmJAJu qEtɶ6ɰ$ 1.. Yan%qX>h[x#.$4%Rwr/ۮ|0L<w- uBtLՠ>A Gk8gR| H.dG &HEI;kr@2<<#rfa.B?Ќ2K a)(I8qG,"&K^`WmeΗ` P+YH|&cf GAZ+r[<Xp9d09rgE'î"^k(·^yHby ,B; OrlrM (j m| ca )2;3 !Y1B^b 4 FC Ʃ(0*/\tC6˹3 c'߉  : =B. %fr32Y^ӝ]FC+P) Q2x`'\h{yu1h:A ې '8<8u:04"*3V"@ӉZU 8z)ԺvH'. 'Mij.D`p`0IE 2xz1L̀@!rpG/'v"Ox ((ȢJ3CKgnW.AA ()! }* L aGt9  (1]0R60L+EظHLfGnvV/NefhMπ;qIB(Ctf«RR(2=NjP[Pcm1hi%tT2=%49-nuaC\,lbwAjxwVM-IE$<Ьh(rjtc\DC ds@wR$US MtF.A )BªΛ - $*"@>Y:NEP YpXgZ6 ?$+po2#92;0LKD2 䒀t `ue@څCk&^F4cc'd,>v >H%Rr33P 6` 7%!S,SPUu#`/JυwF]g0UZtzz"8*3`ɀɔfL D,v-<wOJ;V5(Q R R(@CS2.EѰ,IiY999١QX{A#:@ؗ eagn.1Ea\tHz1DCh JL@JFP PBjW'Zt)%wFg E1$=aZo`(**&@!*,P:PM !`"oXBE6!hb޹(c(靐BzRc@ PB 9>! Xx%` rqMx`eߋIENDB`jsdom-19.0.0/test/to-port-to-wpts/level2/style.js000066400000000000000000000377621415223704400216230ustar00rootroot00000000000000"use strict"; const http = require("http"); const fs = require("fs"); const path = require("path"); const { assert } = require("chai"); const { beforeEach, afterEach, describe, specify } = require("mocha-sugar-free"); const { JSDOM } = require("../../.."); const { createServer, delay } = require("../../util.js"); describe("level2/style", { skipIfBrowser: true }, () => { specify("HTMLStyleElement01", () => { const { window } = new JSDOM(``); const style = window.document.head.lastChild; assert.equal(style.sheet.cssRules.length, 1); assert.equal(style.sheet.cssRules[0].selectorText, "p"); assert.equal(style.sheet.cssRules[0].style.color, "red"); }); specify("HTMLStyleElement02", () => { const { window } = new JSDOM(` `, { runScripts: "dangerously" }); assert.equal(window.document.getElementsByTagName("style").length, 1); assert.equal(window.document.styleSheets.length, 1); }); specify("HTMLStyleAttribute01", () => { const { window } = new JSDOM(`

    `); var p = window.document.body.lastChild; assert.equal(2, p.style.length); assert.equal("color", p.style[0]); assert.equal("red", p.style.color); assert.equal("background-color", p.style[1]); assert.equal("blue", p.style.backgroundColor); }); specify("HTMLCanvasStyleAttribute01", () => { const { window } = new JSDOM(``); var c = window.document.body.lastChild; assert.equal(2, c.style.length); assert.equal("background-color", c.style[0]); assert.equal("blue", c.style.backgroundColor); assert.equal("z-index", c.style[1]); assert.equal(1, c.style.zIndex); }); specify("StylePropertyReflectsStyleAttribute", () => { const { window } = new JSDOM(); var p = window.document.createElement("p"); p.setAttribute("style", "color:red"); assert.equal(1, p.style.length); assert.equal("color", p.style[0]); assert.equal("red", p.style.color); p.setAttribute("style", ""); assert.equal(0, p.style.length); assert.equal("", p.style.color); p.setAttribute("style", "color:blue"); assert.equal("color", p.style[0]); assert.equal("blue", p.style.color); }); specify("StyleAttributeReflectsStyleProperty", () => { const { window } = new JSDOM(); var p = window.document.createElement("p"); p.style.setProperty("color", "red"); assert.equal(p.getAttribute("style"), "color: red;"); p.style.setProperty("width", "20px"); assert.equal(p.getAttribute("style"), "color: red; width: 20px;"); p.style.removeProperty("color"); assert.equal(p.getAttribute("style"), "width: 20px;"); p.style.removeProperty("width"); assert.equal(p.getAttribute("style"), ""); p.style.cssText = "background-color: blue; z-index: 12;"; assert.equal(2, p.style.length); assert.equal("blue", p.style.backgroundColor); assert.equal("12", p.style.zIndex); p.style.removeProperty("z-index"); assert.equal(1, p.style.length); p.style.backgroundColor = "green"; assert.equal("background-color: green;", p.style.cssText); assert.equal("background-color", p.style.item(0)); }); specify("StyleShorthandProperties", () => { const { window } = new JSDOM(); var p = window.document.createElement("p"); p.style.border = "1px solid black"; assert.equal(1, p.style.length); assert.equal("1px solid black", p.style.border); assert.equal("1px", p.style.borderWidth); assert.equal("solid", p.style.borderStyle); assert.equal("black", p.style.borderColor); assert.equal("border: 1px solid black;", p.style.cssText); assert.equal('

    ', p.outerHTML); }); specify("retainOriginalStyleAttributeUntilStyleGetter", () => { const { window } = new JSDOM(); var document = window.document; var div = document.createElement("div"); div.setAttribute("style", "font-weight: bold; font-weight: normal;"); assert.equal(div.getAttribute("style"), "font-weight: bold; font-weight: normal;"); div.innerHTML = "
    "; assert.equal(div.innerHTML, "
    "); assert.equal(div.firstChild.getAttribute("style"), "color: red; color: blue;"); div.firstChild.style.color = "maroon"; assert.equal(div.firstChild.getAttribute("style"), "color: maroon;"); }); specify("getComputedStyleFromDefaultStylesheet1", () => { // browsers have default stylesheets, see https://github.com/jsdom/jsdom/issues/994 var { window } = new JSDOM("
    "); var div = window.document.getElementsByTagName("div")[0]; var cs = window.getComputedStyle(div); assert.equal(cs.display, "block", "computed display of div is block by default"); }); specify("getComputedStyleFromDefaultStylesheet2", () => { // browsers have default stylesheets, see https://github.com/jsdom/jsdom/issues/994 var { window } = new JSDOM("
      "); var ul = window.document.getElementsByTagName("ul")[0]; var cs = window.getComputedStyle(ul); assert.equal(cs.display, "block", "computed display of ul is block by default"); }); specify("getComputedStyleInline", () => { const { window } = new JSDOM(); var document = window.document; var style = document.createElement("style"); style.innerHTML = "p { display: none; }"; document.getElementsByTagName("head")[0].appendChild(style); var p = document.createElement("p"); document.body.appendChild(p); p = document.getElementsByTagName("p")[0]; var cs = window.getComputedStyle(p); assert.equal(cs.display, "none", "computed display of p is none"); }); specify("getComputedStyleFromEmbeddedSheet1", () => { const { window } = new JSDOM(`

      `); var p = window.document.getElementsByTagName("p")[0]; var cs = window.getComputedStyle(p); assert.equal(cs.marginLeft, "100px", "computed marginLeft of p[0] is 100px"); }); specify("getComputedStyleFromEmbeddedSheet2", () => { // use grouping, see http://www.w3.org/TR/CSS2/selector.html#grouping const { window } = new JSDOM(`

      `); var p = window.document.getElementsByTagName("p")[0]; var cs = window.getComputedStyle(p); assert.equal(cs.marginLeft, "100px", "computed marginLeft of p[0] is 100px"); p = window.document.getElementsByTagName("p")[1]; cs = window.getComputedStyle(p); assert.equal(cs.marginLeft, "100px", "computed marginLeft of p[1] is 100px"); }); specify("getComputedStyleFromEmbeddedSheet3", () => { // use grouping with embedded quotes and commas, see https://github.com/jsdom/jsdom/pull/541#issuecomment-18114747 const { window } = new JSDOM(`

      `); var p = window.document.getElementsByTagName("p")[1]; var cs = window.getComputedStyle(p); assert.equal(cs.marginLeft, "100px", "computed marginLeft of p[1] is 100px"); var button = window.document.getElementsByTagName("button")[0]; cs = window.getComputedStyle(button); assert.equal(cs.marginLeft, "100px", "computed marginLeft of button[0] is 100px"); }); specify("ensureRelativeStylesheetFilesAreLoaded", () => { return createServer((req, res) => { try { var content = String(fs.readFileSync(path.resolve(__dirname, "style", req.url.substring(1)))); res.writeHead(200, { "Content-type": req.url.endsWith(".css") ? "text/css" : "text/html", "Content-length": content.length }); res.end(content); } catch (exc) { res.writeHead(404, "not found"); res.end(); } }).then(s => { return JSDOM.fromURL(`http://127.0.0.1:${s.address().port}/relative_import.html`, { resources: "usable" }).then(({ window }) => { return new Promise(resolve => { window.onload = resolve; }).then(() => { return delay(100); // HACK: style imports haven"t been processed yet, different bug }).then(() => { var style = window.getComputedStyle(window.document.body); assert.equal(style.color, "red", "computed color of body is red"); s.close(); }); }); }); }); specify("getComputedStyleExternal", () => { return createServer((req, res) => { const css = `div { color: red; }`; res.writeHead(200, { "Content-type": "text/css", "Content-length": css.length }); res.end(css); }).then(s => { const { window } = new JSDOM(` test
      displayed

      no displayed

      `, { resources: "usable"}); return new Promise(resolve => { window.onload = () => { var div = window.document.getElementsByTagName("div")[0]; var style = window.getComputedStyle(div); assert.equal(style.color, "red", "computed color of div is red"); s.close(); resolve(); }; }); }); }); specify("getComputedStyleWithBadSelectors", () => { const { window } = new JSDOM(); var doc = window.document; var style = doc.createElement("style"); style.innerHTML = ";p { display: none; }"; doc.getElementsByTagName("head")[0].appendChild(style); var p = doc.createElement("p"); doc.body.appendChild(p); p = doc.getElementsByTagName("p")[0]; assert.doesNotThrow(function () { window.getComputedStyle(p); }); }); specify("getComputedStyleWithMediaRules", () => { const { window } = new JSDOM(`

      Hello

      `); var style = window.getComputedStyle(window.document.querySelector(".citation")); assert.equal(style.color, "blue", "computed color of p is blue"); }); specify("getComputedStyleWithKeyframeRules", () => { const { window } = new JSDOM(`

      Hello

      `); assert.doesNotThrow(function () { window.getComputedStyle(window.document.querySelector("p")); }); }); specify("setStyleToInvalidCSSSyntax", () => { const node = (new JSDOM()).window.document.createElement("div"); const invalidStyles = [ "color: red; }", "color: \"red", "color: red;' ", "color: red; /*", "color: attr(", "color: ", "color: /*red" ]; invalidStyles.forEach(function (style) { node.setAttribute("style", "color: red"); assert.doesNotThrow(function () { node.setAttribute("style", style); }); assert.strictEqual(node.getAttribute("style"), style); assert.strictEqual(node.style.color, ""); assert.strictEqual(node.style.cssText, ""); node.style.cssText = "color: red"; assert.doesNotThrow(function () { node.style.cssText = style; }); assert.strictEqual(node.style.color, ""); assert.strictEqual(node.style.cssText, ""); }); }); specify("getStyleSheetByItem", (t) => { const { window } = new JSDOM(``); var sheets = window.document.styleSheets; assert.equal(2, sheets.length); assert.equal(sheets[0], sheets.item(0)); assert.equal(sheets[1], sheets.item(1)); assert.equal("red", sheets.item(0).cssRules[0].style.color); assert.equal("green", sheets.item(1).cssRules[0].style.color); }); specify("parseStyleWithBogusComment", () => { // https://github.com/jsdom/jsdom/issues/1214 const { window } = new JSDOM(``); // Should not hang forever window.getComputedStyle(window.document.body); }); specify("padding and margin component properties work correctly (GH-1353)", () => { const document = (new JSDOM()).window.document; for (const prop of ["padding", "margin"]) { document.body.style[prop] = "1px 2px 3px 4px"; assert.strictEqual(document.body.style[prop], "1px 2px 3px 4px"); assert.strictEqual(document.body.style[prop + "Top"], "1px"); assert.strictEqual(document.body.style[prop + "Right"], "2px"); assert.strictEqual(document.body.style[prop + "Bottom"], "3px"); assert.strictEqual(document.body.style[prop + "Left"], "4px"); document.body.style[prop + "Top"] = "1em"; document.body.style[prop + "Right"] = "2em"; document.body.style[prop + "Bottom"] = "3em"; document.body.style[prop + "Left"] = "4em"; assert.strictEqual(document.body.style[prop], "1em 2em 3em 4em"); document.body.style[prop] = "1mm"; assert.strictEqual(document.body.style[prop], "1mm"); assert.strictEqual(document.body.style[prop + "Top"], "1mm"); assert.strictEqual(document.body.style[prop + "Right"], "1mm"); assert.strictEqual(document.body.style[prop + "Bottom"], "1mm"); assert.strictEqual(document.body.style[prop + "Left"], "1mm"); document.body.style[prop] = "1% 2%"; assert.strictEqual(document.body.style[prop], "1% 2%"); assert.strictEqual(document.body.style[prop + "Top"], "1%"); assert.strictEqual(document.body.style[prop + "Right"], "2%"); assert.strictEqual(document.body.style[prop + "Bottom"], "1%"); assert.strictEqual(document.body.style[prop + "Left"], "2%"); document.body.style[prop] = "3pc 2pc 1pc"; assert.strictEqual(document.body.style[prop], "3pc 2pc 1pc"); assert.strictEqual(document.body.style[prop + "Top"], "3pc"); assert.strictEqual(document.body.style[prop + "Right"], "2pc"); assert.strictEqual(document.body.style[prop + "Bottom"], "1pc"); assert.strictEqual(document.body.style[prop + "Left"], "2pc"); } }); specify("StyleSheetList.prototype.item returns null on index out of bounds", () => { const document = (new JSDOM()).window.document; assert.strictEqual(document.styleSheets[0], undefined); assert.strictEqual(document.styleSheets.item(0), null); }); specify("setting background to null works correctly (GH-1499)", () => { const document = (new JSDOM()).window.document; document.body.innerHTML = `
      `; const div = document.body.firstChild; div.style.background = null; assert.strictEqual(div.style.background, ""); }); specify("setting width to auto works correctly (GH-1458)", () => { const document = (new JSDOM()).window.document; document.body.style.width = "auto"; assert.strictEqual(document.body.style.width, "auto"); assert.strictEqual(document.body.style.cssText, "width: auto;"); }); }); jsdom-19.0.0/test/to-port-to-wpts/level2/style/000077500000000000000000000000001415223704400212465ustar00rootroot00000000000000jsdom-19.0.0/test/to-port-to-wpts/level2/style/external_css.html000066400000000000000000000002521415223704400246250ustar00rootroot00000000000000 something in the body jsdom-19.0.0/test/to-port-to-wpts/level2/style/getComputedStyleExternal.html000066400000000000000000000003341415223704400271400ustar00rootroot00000000000000 test
      displayed

      no displayed

      jsdom-19.0.0/test/to-port-to-wpts/level2/style/relative/000077500000000000000000000000001415223704400230615ustar00rootroot00000000000000jsdom-19.0.0/test/to-port-to-wpts/level2/style/relative/a/000077500000000000000000000000001415223704400233015ustar00rootroot00000000000000jsdom-19.0.0/test/to-port-to-wpts/level2/style/relative/a/b/000077500000000000000000000000001415223704400235225ustar00rootroot00000000000000jsdom-19.0.0/test/to-port-to-wpts/level2/style/relative/a/b/other.css000066400000000000000000000000261415223704400253530ustar00rootroot00000000000000body { color: red; } jsdom-19.0.0/test/to-port-to-wpts/level2/style/relative/style.css000066400000000000000000000000311415223704400247250ustar00rootroot00000000000000@import 'a/b/other.css'; jsdom-19.0.0/test/to-port-to-wpts/level2/style/relative_import.html000066400000000000000000000002421415223704400253370ustar00rootroot00000000000000 something in the body jsdom-19.0.0/test/to-port-to-wpts/level3/000077500000000000000000000000001415223704400201075ustar00rootroot00000000000000jsdom-19.0.0/test/to-port-to-wpts/level3/core/000077500000000000000000000000001415223704400210375ustar00rootroot00000000000000jsdom-19.0.0/test/to-port-to-wpts/level3/core/files/000077500000000000000000000000001415223704400221415ustar00rootroot00000000000000jsdom-19.0.0/test/to-port-to-wpts/level3/core/files/barfoo.xml.js000066400000000000000000000011141415223704400245430ustar00rootroot00000000000000/* '> ]> replaceWholeText sample

      bar

      */ jsdom-19.0.0/test/to-port-to-wpts/level3/core/files/barfoo_nodefaultns.xml.js000066400000000000000000000014031415223704400271460ustar00rootroot00000000000000/* '> ]> test file bar */jsdom-19.0.0/test/to-port-to-wpts/level3/core/files/barfoo_standalone_no.xml.js000066400000000000000000000012031415223704400274460ustar00rootroot00000000000000/* '> ]> replaceWholeText sample

      bar

      */jsdom-19.0.0/test/to-port-to-wpts/level3/core/files/barfoo_standalone_yes.xml.js000066400000000000000000000012061415223704400276350ustar00rootroot00000000000000/* '> ]> getXmlStandalone test doc

      bar

      */jsdom-19.0.0/test/to-port-to-wpts/level3/core/files/barfoo_utf16.xml.js000066400000000000000000000043111415223704400255720ustar00rootroot00000000000000/* '> ]> test file

      bar

      */ var core = require('../../../../../lib/jsdom/living'); exports.barfoo_utf16 = function() { var doc = new core.Document(); var ns = 'http://www.w3.org/2000/xmlns/'; var implementation = new core.DOMImplementation(doc, {'XML': ['1.0', '2.0'], 'core': ['1.0', '2.0', '3.0']}); var notations = new core.NotationNodeMap(doc, doc.createNotationNode('notation1', 'notation1File', null)); var entities = new core.EntityNodeMap(doc, doc.createEntityNode('ent1', doc.createTextNode('foo')), doc.createEntityNode('ent2', doc.createTextNode('foo
      '))); var attributes = new core.NamedNodeMap(doc); var item = doc.createElementNS(ns, 'html'); item.setAttribute('xmlns'); attributes.setNamedItem(item); // item = doc.createElementNS(ns, 'script'); // item.setAttribute('src'); // item.setAttribute('type'); // item.setAttribute('charset'); // attributes.setNamedItem(item); item = doc.createElementNS(ns, 'body'); item.setAttribute('onload'); attributes.setNamedItem(item); doc.doctype = new core.DocumentType(doc, 'xml', entities, notations, attributes); doc.implementation = implementation; var html = doc.appendChild(doc.createElementNS(ns, 'html')); var head = html.appendChild(doc.createElementNS(ns, 'head')); var title = doc.createElementNS(ns, 'title'); title.appendChild(doc.createTextNode('test file')); head.appendChild(title); var body = html.appendChild(doc.createElementNS(ns, 'body')); body.setAttribute('onload', 'parent.loadComplete()'); var p = doc.createElementNS(ns, 'p'); p.appendChild(doc.createTextNode('bar')); body.appendChild(p); doc.normalize(); return(doc); }; jsdom-19.0.0/test/to-port-to-wpts/level3/core/files/barfoo_utf8.xml.js000066400000000000000000000044721415223704400255230ustar00rootroot00000000000000/* '> ]> test file

      bar

      */ var core = require('../../../../../lib/jsdom/living'); exports.barfoo_utf8 = function() { var doc = new core.Document(); var ns = 'http://www.w3.org/2000/xmlns/'; var implementation = new core.DOMImplementation(doc, {'XML': ['1.0', '2.0'], 'core': ['1.0', '2.0', '3.0']}); var notations = new core.NotationNodeMap(doc, doc.createNotationNode('notation1', 'notation1File', null)); var entities = new core.EntityNodeMap(doc, doc.createEntityNode('ent1', doc.createTextNode('foo')), doc.createEntityNode('ent2', doc.createTextNode('foo
      '))); var attributes = new core.NamedNodeMap(doc); var item = doc.createElementNS(ns, 'html'); item.setAttribute('xmlns'); attributes.setNamedItem(item); item = doc.createElementNS(ns, 'script'); item.setAttribute('src'); item.setAttribute('type'); item.setAttribute('charset'); attributes.setNamedItem(item); item = doc.createElementNS(ns, 'body'); item.setAttribute('onload'); attributes.setNamedItem(item); doc.doctype = new core.DocumentType(doc, 'xml', entities, notations, attributes); doc.implementation = implementation; var html = doc.appendChild(doc.createElementNS(ns, 'html')); var head = html.appendChild(doc.createElementNS(ns, 'head')); var title = doc.createElementNS(ns, 'title'); title.appendChild(doc.createTextNode('test file')); head.appendChild(title); var body = html.appendChild(doc.createElementNS(ns, 'body')); body.setAttribute('onload', 'parent.loadComplete()'); var p = doc.createElementNS(ns, 'p'); p.appendChild(doc.createTextNode('bar')); body.appendChild(p); doc.normalize(); return(doc); }; jsdom-19.0.0/test/to-port-to-wpts/level3/core/files/datatype_normalization.xml.js000066400000000000000000000055471415223704400300720ustar00rootroot00000000000000/* ]> -31415926.00E-7 2.718 INF -INF -0 false true false 0 1 0 +10 .1 -.001 -31415926.00E-7 2.718 INF -INF -0 2004-01-21T15:30:00 2004-01-21T15:30:00Z 2004-01-21T15:30:00.0000 2004-01-21T15:30:00.0001 */jsdom-19.0.0/test/to-port-to-wpts/level3/core/files/datatype_normalization2.xml.js000066400000000000000000000017301415223704400301420ustar00rootroot00000000000000/* ]> datatype_normalization2

      EMP 0001 EMP 0001 EMP 0001 EMP 0001 EMP 0001 EMP 0001 EMP 0001 EMP 0001 EMP 0001

      */ jsdom-19.0.0/test/to-port-to-wpts/level3/core/files/external_barfoo.xml.js000066400000000000000000000017261415223704400264560ustar00rootroot00000000000000/* ]> external entity encoding sample

      bar&ent2;&ent1;

      bar&ent2;&ent1;

      &ent3; */ jsdom-19.0.0/test/to-port-to-wpts/level3/core/files/hc_nodtdstaff.xml.js000066400000000000000000000147341415223704400261150ustar00rootroot00000000000000var dom = require("../../../../../lib/jsdom/living"); exports.hc_staff = function() { var doc = new dom.Document("html"); var implementation = new dom.DOMImplementation(doc, { "XML" : ["1.0", "2.0"], "core": ["1.0", "2.0", "3.0"] }); var notations = new dom.NotationNodeMap( doc, doc.createNotationNode("notation1","notation1File", null), doc.createNotationNode("notation2",null, "notation2File") ); // TODO: consider importing the master list of entities // http://www.w3schools.com/tags/ref_symbols.asp var entities = new dom.EntityNodeMap( doc, doc.createEntityNode("alpha", doc.createTextNode("α")), doc.createEntityNode("beta", doc.createTextNode("β")), doc.createEntityNode("gamma", doc.createTextNode("γ")), doc.createEntityNode("delta", doc.createTextNode("δ")), doc.createEntityNode("epsilon", doc.createTextNode("ε")) ); // var defaultAttributes = new dom.NamedNodeMap(doc); var acronym = doc.createElementNS("http://www.w3.org/2000/xmlns/","acronym"); acronym.setAttribute("dir", "ltr"); defaultAttributes.setNamedItem(acronym); var doctype = new dom.DocumentType(doc, "xml", entities, notations, defaultAttributes); doc.doctype = doctype; doc.implementation = implementation; doc.appendChild(doc.createComment(" This is comment number 1.")); var html = doc.createElementNS("http://www.w3.org/2000/xmlns/","html"); var html = doc.appendChild(html); var head = doc.createElementNS("http://www.w3.org/2000/xmlns/","head"); var head = html.appendChild(head); var meta = doc.createElementNS("http://www.w3.org/2000/xmlns/","meta"); meta.setAttribute("http-equiv", "Content-Type"); meta.setAttribute("content", "text/html; charset=UTF-8"); head.appendChild(meta); var title = doc.createElementNS("http://www.w3.org/2000/xmlns/","title") title.appendChild(doc.createTextNode("hc_staff")); var title = head.appendChild(title); // make the tests work.... head.appendChild(doc.createElementNS("http://www.w3.org/2000/xmlns/","script")); head.appendChild(doc.createElementNS("http://www.w3.org/2000/xmlns/","script")); head.appendChild(doc.createElementNS("http://www.w3.org/2000/xmlns/","script")); var body = doc.createElementNS("http://www.w3.org/2000/xmlns/","body"); var staff = html.appendChild(body); var employees = []; var addresses = []; var names = []; var positions = []; var genders = []; var ids = []; var salaries = []; // create 5 employees for (var i=0; i<5; i++) { var employee = doc.createElementNS("http://www.w3.org/2000/xmlns/","p"); var address = doc.createElementNS("http://www.w3.org/2000/xmlns/","acronym"); var name = doc.createElementNS("http://www.w3.org/2000/xmlns/","strong"); var position = doc.createElementNS("http://www.w3.org/2000/xmlns/","code"); var gender = doc.createElementNS("http://www.w3.org/2000/xmlns/","var"); var id = doc.createElementNS("http://www.w3.org/2000/xmlns/","em"); var salary = doc.createElementNS("http://www.w3.org/2000/xmlns/","sup"); employee.appendChild(doc.createTextNode("\n")); employee.appendChild(id); employee.appendChild(doc.createTextNode("\n")); employee.appendChild(name); employee.appendChild(doc.createTextNode("\n")); employee.appendChild(position); employee.appendChild(doc.createTextNode("\n")); employee.appendChild(salary); employee.appendChild(doc.createTextNode("\n")); employee.appendChild(gender); employee.appendChild(doc.createTextNode("\n")); employee.appendChild(address); employee.appendChild(doc.createTextNode("\n")); staff.appendChild(employee); names.push(name); employees.push(employee); addresses.push(address); genders.push(gender); positions.push(position); ids.push(id); salaries.push(salary); } ids[0].appendChild(doc.createTextNode("EMP0001")); salaries[0].appendChild(doc.createTextNode("56,000")); addresses[0].setAttribute("title", "Yes"); addresses[0].appendChild(doc.createTextNode('1230 North Ave. Dallas, Texas 98551')); names[0].appendChild(doc.createTextNode("Margaret Martin")); genders[0].appendChild(doc.createTextNode("Female")); positions[0].appendChild(doc.createTextNode("Accountant")); ids[1].appendChild(doc.createTextNode("EMP0002")); salaries[1].appendChild(doc.createTextNode("35,000")); addresses[1].setAttribute("title", "Yes"); addresses[1].setAttribute("class", "Yes"); addresses[1].appendChild(doc.createTextNode("β Dallas, γ\n 98554")); names[1].appendChild(doc.createTextNode("Martha Raynolds")); names[1].appendChild(doc.createCDATASection("This is a CDATASection with EntityReference number 2 &ent2;")); names[1].appendChild(doc.createCDATASection("This is an adjacent CDATASection with a reference to a tab &tab;")); genders[1].appendChild(doc.createTextNode("Female")); positions[1].appendChild(doc.createTextNode("Secretary")); ids[2].appendChild(doc.createTextNode("EMP0003")); salaries[2].appendChild(doc.createTextNode("100,000")); addresses[2].setAttribute("title", "Yes"); addresses[2].setAttribute("class", "No"); addresses[2].appendChild(doc.createTextNode("PO Box 27 Irving, texas 98553")); names[2].appendChild(doc.createTextNode("Roger\n Jones")) ; genders[2].appendChild(doc.createEntityReference("δ"));//Text("δ")); positions[2].appendChild(doc.createTextNode("Department Manager")); ids[3].appendChild(doc.createTextNode("EMP0004")); salaries[3].appendChild(doc.createTextNode("95,000")); addresses[3].setAttribute("title", "Yes"); addresses[3].setAttribute("class", "Yα"); addresses[3].appendChild(doc.createTextNode("27 South Road. Dallas, Texas 98556")); names[3].appendChild(doc.createTextNode("Jeny Oconnor")); genders[3].appendChild(doc.createTextNode("Female")); positions[3].appendChild(doc.createTextNode("Personal Director")); ids[4].appendChild(doc.createTextNode("EMP0005")); salaries[4].appendChild(doc.createTextNode("90,000")); addresses[4].setAttribute("title", "Yes"); addresses[4].appendChild(doc.createTextNode("1821 Nordic. Road, Irving Texas 98558")); names[4].appendChild(doc.createTextNode("Robert Myers")); genders[4].appendChild(doc.createTextNode("male")); positions[4].appendChild(doc.createTextNode("Computer Specialist")); doc.appendChild(doc.createProcessingInstruction("TEST-STYLE", "PIDATA")); doc.normalize(); return doc; }; jsdom-19.0.0/test/to-port-to-wpts/level3/core/files/hc_staff.xml.js000066400000000000000000000150171415223704400250570ustar00rootroot00000000000000var dom = require("../../../../../lib/jsdom/living"); exports.hc_staff = function() { var doc = new dom.Document("html"); var implementation = new dom.DOMImplementation(doc, { "XML" : ["1.0", "2.0"], "core": ["1.0", "2.0", "3.0"] }); var notations = new dom.NotationNodeMap( doc, doc.createNotationNode("notation1","notation1File", null), doc.createNotationNode("notation2",null, "notation2File") ); // TODO: consider importing the master list of entities // http://www.w3schools.com/tags/ref_symbols.asp var entities = new dom.EntityNodeMap( doc, doc.createEntityNode("alpha", doc.createTextNode("α")), doc.createEntityNode("beta", doc.createTextNode("β")), doc.createEntityNode("gamma", doc.createTextNode("γ")), doc.createEntityNode("delta", doc.createTextNode("δ")), doc.createEntityNode("epsilon", doc.createTextNode("ε")) ); // var defaultAttributes = new dom.NamedNodeMap(doc); var acronym = doc.createElementNS("http://www.w3.org/2000/xmlns/","acronym"); acronym.setAttribute("dir", "ltr"); defaultAttributes.setNamedItem(acronym); var doctype = new dom.DocumentType(doc, "xml", entities, notations, defaultAttributes); doc.doctype = doctype; doc.implementation = implementation; doc.appendChild(doc.createComment(" This is comment number 1.")); var html = doc.createElementNS("http://www.w3.org/2000/xmlns/","html"); var html = doc.appendChild(html); var head = doc.createElementNS("http://www.w3.org/2000/xmlns/","head"); var head = html.appendChild(head); var meta = doc.createElementNS("http://www.w3.org/2000/xmlns/","meta"); meta.setAttribute("http-equiv", "Content-Type"); meta.setAttribute("content", "text/html; charset=UTF-8"); head.appendChild(meta); var title = doc.createElementNS("http://www.w3.org/2000/xmlns/","title") title.appendChild(doc.createTextNode("hc_staff")); var title = head.appendChild(title); // make the tests work.... head.appendChild(doc.createElementNS("http://www.w3.org/2000/xmlns/","script")); head.appendChild(doc.createElementNS("http://www.w3.org/2000/xmlns/","script")); head.appendChild(doc.createElementNS("http://www.w3.org/2000/xmlns/","script")); var body = doc.createElementNS("http://www.w3.org/2000/xmlns/","body"); var staff = html.appendChild(body); var employees = []; var addresses = []; var names = []; var positions = []; var genders = []; var ids = []; var salaries = []; // create 5 employees for (var i=0; i<5; i++) { var employee = doc.createElementNS("http://www.w3.org/2000/xmlns/","p"); var address = doc.createElementNS("http://www.w3.org/2000/xmlns/","acronym"); var name = doc.createElementNS("http://www.w3.org/2000/xmlns/","strong"); var position = doc.createElementNS("http://www.w3.org/2000/xmlns/","code"); var gender = doc.createElementNS("http://www.w3.org/2000/xmlns/","var"); var id = doc.createElementNS("http://www.w3.org/2000/xmlns/","em"); var salary = doc.createElementNS("http://www.w3.org/2000/xmlns/","sup"); employee.appendChild(doc.createTextNode("\n")); employee.appendChild(id); employee.appendChild(doc.createTextNode("\n")); employee.appendChild(name); employee.appendChild(doc.createTextNode("\n")); employee.appendChild(position); employee.appendChild(doc.createTextNode("\n")); employee.appendChild(salary); employee.appendChild(doc.createTextNode("\n")); employee.appendChild(gender); employee.appendChild(doc.createTextNode("\n")); employee.appendChild(address); employee.appendChild(doc.createTextNode("\n")); staff.appendChild(employee); names.push(name); employees.push(employee); addresses.push(address); genders.push(gender); positions.push(position); ids.push(id); salaries.push(salary); } ids[0].appendChild(doc.createTextNode("EMP0001")); salaries[0].appendChild(doc.createTextNode("56,000")); addresses[0].setAttribute("title", "Yes"); addresses[0].appendChild(doc.createTextNode('1230 North Ave. Dallas, Texas 98551')); names[0].appendChild(doc.createTextNode("Margaret Martin")); genders[0].appendChild(doc.createTextNode("Female")); positions[0].appendChild(doc.createTextNode("Accountant")); ids[1].appendChild(doc.createTextNode("EMP0002")); salaries[1].appendChild(doc.createTextNode("35,000")); addresses[1].setAttribute("title", "Yes"); addresses[1].setAttribute("class", "Yes"); addresses[1].appendChild(doc.createTextNode("β Dallas, γ\n 98554")); names[1].appendChild(doc.createTextNode("Martha Raynolds")); names[1].appendChild(doc.createCDATASection("This is a CDATASection with EntityReference number 2 &ent2;")); names[1].appendChild(doc.createCDATASection("This is an adjacent CDATASection with a reference to a tab &tab;")); genders[1].appendChild(doc.createTextNode("Female")); positions[1].appendChild(doc.createTextNode("Secretary")); ids[2].appendChild(doc.createTextNode("EMP0003")); salaries[2].appendChild(doc.createTextNode("100,000")); addresses[2].setAttribute("title", "Yes"); addresses[2].setAttribute("class", "No"); addresses[2].appendChild(doc.createTextNode("PO Box 27 Irving, texas 98553")); names[2].appendChild(doc.createTextNode("Roger\n Jones")) ; genders[2].appendChild(doc.createEntityReference("δ"));//Text("δ")); positions[2].appendChild(doc.createTextNode("Department Manager")); ids[3].appendChild(doc.createTextNode("EMP0004")); salaries[3].appendChild(doc.createTextNode("95,000")); addresses[3].setAttribute("title", "Yes"); addresses[3].setAttribute("class", "Yα"); addresses[3].setAttribute("id", "emp4_addr"); addresses[3].appendChild(doc.createTextNode("27 South Road. Dallas, Texas 98556")); names[3].appendChild(doc.createTextNode("Jeny Oconnor")); genders[3].appendChild(doc.createTextNode("Female")); positions[3].appendChild(doc.createTextNode("Personal Director")); ids[4].appendChild(doc.createTextNode("EMP0005")); salaries[4].appendChild(doc.createTextNode("90,000")); addresses[4].setAttribute("title", "Yes"); addresses[4].appendChild(doc.createTextNode("1821 Nordic. Road, Irving Texas 98558")); names[4].appendChild(doc.createTextNode("Robert Myers")); genders[4].appendChild(doc.createTextNode("male")); positions[4].appendChild(doc.createTextNode("Computer Specialist")); doc.appendChild(doc.createProcessingInstruction("TEST-STYLE", "PIDATA")); doc.normalize(); return doc; }; jsdom-19.0.0/test/to-port-to-wpts/level3/core/files/orig/000077500000000000000000000000001415223704400231015ustar00rootroot00000000000000jsdom-19.0.0/test/to-port-to-wpts/level3/core/files/orig/Yes000066400000000000000000000017001415223704400235620ustar00rootroot00000000000000 jsdom-19.0.0/test/to-port-to-wpts/level3/core/files/orig/back.gif000066400000000000000000000003301415223704400244640ustar00rootroot00000000000000GIF89afff333!NThis art is in the public domain. Kevin Hughes, kevinh@eit.com, September 1995!,K#j3Si7Nvt7*EnXm/5FPxƤl(N ڌ:@VUϋ;jsdom-19.0.0/test/to-port-to-wpts/level3/core/files/orig/barfoo.svg000066400000000000000000000014001415223704400250650ustar00rootroot00000000000000 '> ]>

      bar

      jsdom-19.0.0/test/to-port-to-wpts/level3/core/files/orig/barfoo.xhtml000066400000000000000000000011101415223704400254200ustar00rootroot00000000000000 '> ]> replaceWholeText sample

      bar

      jsdom-19.0.0/test/to-port-to-wpts/level3/core/files/orig/barfoo.xml000066400000000000000000000011101415223704400250640ustar00rootroot00000000000000 '> ]> replaceWholeText sample

      bar

      jsdom-19.0.0/test/to-port-to-wpts/level3/core/files/orig/barfoo_base.svg000066400000000000000000000022121415223704400260610ustar00rootroot00000000000000 '> ]> XML Base sample

      bar

      jsdom-19.0.0/test/to-port-to-wpts/level3/core/files/orig/barfoo_base.xhtml000066400000000000000000000014121415223704400264170ustar00rootroot00000000000000 '> ]> XML Base sample

      bar

      jsdom-19.0.0/test/to-port-to-wpts/level3/core/files/orig/barfoo_base.xml000066400000000000000000000014121415223704400260630ustar00rootroot00000000000000 '> ]> XML Base sample

      bar

      jsdom-19.0.0/test/to-port-to-wpts/level3/core/files/orig/barfoo_base.xml.js000066400000000000000000000014161415223704400265020ustar00rootroot00000000000000/* '> ]> XML Base sample

      bar

      */jsdom-19.0.0/test/to-port-to-wpts/level3/core/files/orig/barfoo_nodefaultns.svg000066400000000000000000000016761415223704400275060ustar00rootroot00000000000000 '> ]> &svgtest;&svgunit; bar jsdom-19.0.0/test/to-port-to-wpts/level3/core/files/orig/barfoo_nodefaultns.xhtml000066400000000000000000000013771415223704400300410ustar00rootroot00000000000000 '> ]> test file bar jsdom-19.0.0/test/to-port-to-wpts/level3/core/files/orig/barfoo_nodefaultns.xml000066400000000000000000000013771415223704400275050ustar00rootroot00000000000000 '> ]> test file bar jsdom-19.0.0/test/to-port-to-wpts/level3/core/files/orig/barfoo_standalone_no.svg000066400000000000000000000014671415223704400300060ustar00rootroot00000000000000 '> ]>

      bar

      jsdom-19.0.0/test/to-port-to-wpts/level3/core/files/orig/barfoo_standalone_no.xhtml000066400000000000000000000011771415223704400303410ustar00rootroot00000000000000 '> ]> replaceWholeText sample

      bar

      jsdom-19.0.0/test/to-port-to-wpts/level3/core/files/orig/barfoo_standalone_no.xml000066400000000000000000000011771415223704400300050ustar00rootroot00000000000000 '> ]> replaceWholeText sample

      bar

      jsdom-19.0.0/test/to-port-to-wpts/level3/core/files/orig/barfoo_standalone_yes.svg000066400000000000000000000011431415223704400301610ustar00rootroot00000000000000 '> ]>

      bar

      jsdom-19.0.0/test/to-port-to-wpts/level3/core/files/orig/barfoo_standalone_yes.xhtml000066400000000000000000000012021415223704400305120ustar00rootroot00000000000000 '> ]> getXmlStandalone test doc

      bar

      jsdom-19.0.0/test/to-port-to-wpts/level3/core/files/orig/barfoo_standalone_yes.xml000066400000000000000000000012021415223704400301560ustar00rootroot00000000000000 '> ]> getXmlStandalone test doc

      bar

      jsdom-19.0.0/test/to-port-to-wpts/level3/core/files/orig/barfoo_utf16.svg000066400000000000000000000035441415223704400261250ustar00rootroot00000000000000<?xml version="1.0" encoding="uTf-16"?> <!DOCTYPE svg [ <!ENTITY ent1 'foo'> <!ENTITY ent2 'foo<br/>'> <!ELEMENT svg (rect,script,body)> <!ATTLIST svg xmlns CDATA #IMPLIED> <!ELEMENT rect EMPTY> <!ATTLIST rect x CDATA #REQUIRED y CDATA #REQUIRED width CDATA #REQUIRED height CDATA #REQUIRED fill CDATA #REQUIRED> <!ELEMENT p (#PCDATA|br)*> <!ELEMENT body (p)> <!ATTLIST body xmlns CDATA #IMPLIED> <!ELEMENT br EMPTY> <!ELEMENT script (#PCDATA)> <!ATTLIST script type CDATA #IMPLIED> <!ENTITY svgunit SYSTEM "svgunit.js"> <!ENTITY svgtest SYSTEM "svgtest.js"> <!ENTITY ent5 PUBLIC "entityURI" "entityFile" NDATA notation1> <!NOTATION notation1 PUBLIC "notation1File"> ]> <svg xmlns="http://www.w3.org/2000/svg"> <rect x="0" y="0" width="100" height="100" fill="blue"/><script type="text/ecmascript">&svgtest;&svgunit;</script> <body xmlns='http://www.w3.org/1999/xhtml'> <p>bar</p> </body> </svg>jsdom-19.0.0/test/to-port-to-wpts/level3/core/files/orig/barfoo_utf16.xhtml000066400000000000000000000020721415223704400264550ustar00rootroot00000000000000<?xml version="1.0" encoding="uTf-16"?> <!DOCTYPE html [ <!ENTITY ent1 'foo'> <!ENTITY ent2 'foo<br/>'> <!ELEMENT html (head, body)> <!ATTLIST html xmlns CDATA #IMPLIED> <!ELEMENT head (title)> <!ELEMENT title (#PCDATA)> <!ELEMENT body (p)> <!ELEMENT p (#PCDATA|br)*> <!ELEMENT br EMPTY> <!ENTITY ent5 PUBLIC "entityURI" "entityFile" NDATA notation1> <!NOTATION notation1 PUBLIC "notation1File"> ]> <html xmlns='http://www.w3.org/1999/xhtml'> <head> <title>test file</title> </head> <body> <p>bar</p> </body> </html> jsdom-19.0.0/test/to-port-to-wpts/level3/core/files/orig/barfoo_utf16.xml000066400000000000000000000023061415223704400261210ustar00rootroot00000000000000<?xml version="1.0" encoding="uTf-16"?> <!DOCTYPE html [ <!ENTITY ent1 'foo'> <!ENTITY ent2 'foo<br/>'> <!ELEMENT html (head, body)> <!ATTLIST html xmlns CDATA #IMPLIED> <!ELEMENT head (title)> <!ELEMENT title (#PCDATA)> <!ELEMENT body (p)> <!ATTLIST body onload CDATA #IMPLIED> <!ELEMENT p (#PCDATA|br)*> <!ELEMENT br EMPTY> <!ENTITY ent5 PUBLIC "entityURI" "entityFile" NDATA notation1> <!NOTATION notation1 PUBLIC "notation1File"> ]> <html xmlns='http://www.w3.org/1999/xhtml'> <head> <title>test file</title> </head> <body onload="parent.loadCompleted()"> <p>bar</p> </body> </html> jsdom-19.0.0/test/to-port-to-wpts/level3/core/files/orig/barfoo_utf8.svg000066400000000000000000000016231415223704400260420ustar00rootroot00000000000000 '> ]>

      bar

      jsdom-19.0.0/test/to-port-to-wpts/level3/core/files/orig/barfoo_utf8.xhtml000066400000000000000000000013151415223704400263750ustar00rootroot00000000000000 '> ]> test file

      bar

      jsdom-19.0.0/test/to-port-to-wpts/level3/core/files/orig/barfoo_utf8.xml000066400000000000000000000013151415223704400260410ustar00rootroot00000000000000 '> ]> test file

      bar

      jsdom-19.0.0/test/to-port-to-wpts/level3/core/files/orig/blank.gif000066400000000000000000000002241415223704400246550ustar00rootroot00000000000000GIF89a!NThis art is in the public domain. Kevin Hughes, kevinh@eit.com, September 1995!,ڋ޼I;jsdom-19.0.0/test/to-port-to-wpts/level3/core/files/orig/canonicalform01.svg000066400000000000000000000010071415223704400265740ustar00rootroot00000000000000 ]>

      Hello, world!

      jsdom-19.0.0/test/to-port-to-wpts/level3/core/files/orig/canonicalform01.xhtml000066400000000000000000000005601415223704400271340ustar00rootroot00000000000000 canonicalform01

      Hello, world!

      jsdom-19.0.0/test/to-port-to-wpts/level3/core/files/orig/canonicalform01.xml000066400000000000000000000005601415223704400266000ustar00rootroot00000000000000 canonicalform01

      Hello, world!

      jsdom-19.0.0/test/to-port-to-wpts/level3/core/files/orig/canonicalform02.svg000066400000000000000000000007351415223704400266040ustar00rootroot00000000000000 ]> A B

      A B A B C

      jsdom-19.0.0/test/to-port-to-wpts/level3/core/files/orig/canonicalform02.xhtml000066400000000000000000000004341415223704400271350ustar00rootroot00000000000000canonicalform02 A B

      A B A B C

      jsdom-19.0.0/test/to-port-to-wpts/level3/core/files/orig/canonicalform02.xml000066400000000000000000000004341415223704400266010ustar00rootroot00000000000000canonicalform02 A B

      A B A B C

      jsdom-19.0.0/test/to-port-to-wpts/level3/core/files/orig/canonicalform03.svg000066400000000000000000000015771415223704400266120ustar00rootroot00000000000000 ]>


      jsdom-19.0.0/test/to-port-to-wpts/level3/core/files/orig/canonicalform03.xhtml000066400000000000000000000013171415223704400271370ustar00rootroot00000000000000]> canonicalform03


      jsdom-19.0.0/test/to-port-to-wpts/level3/core/files/orig/canonicalform03.xml000066400000000000000000000013171415223704400266030ustar00rootroot00000000000000]> canonicalform03


      jsdom-19.0.0/test/to-port-to-wpts/level3/core/files/orig/canonicalform04.svg000066400000000000000000000014011415223704400265750ustar00rootroot00000000000000 ]> First line Second line 2 "0" && value<"10" ?"valid":"error"]]> valid
      jsdom-19.0.0/test/to-port-to-wpts/level3/core/files/orig/canonicalform04.xhtml000066400000000000000000000011551415223704400271400ustar00rootroot00000000000000 ]> canonicalform04 First line Second line 2 "0" && value<"10" ?"valid":"error"]]> valid
      jsdom-19.0.0/test/to-port-to-wpts/level3/core/files/orig/canonicalform04.xml000066400000000000000000000011551415223704400266040ustar00rootroot00000000000000 ]> canonicalform04 First line Second line 2 "0" && value<"10" ?"valid":"error"]]> valid
      jsdom-19.0.0/test/to-port-to-wpts/level3/core/files/orig/canonicalform05.svg000066400000000000000000000011251415223704400266010ustar00rootroot00000000000000 ]>

      &ent1;, &ent2;!

      jsdom-19.0.0/test/to-port-to-wpts/level3/core/files/orig/canonicalform05.xhtml000066400000000000000000000007011415223704400271350ustar00rootroot00000000000000 ]> canonicalform05

      &ent1;, &ent2;!

      jsdom-19.0.0/test/to-port-to-wpts/level3/core/files/orig/canonicalform05.xml000066400000000000000000000007011415223704400266010ustar00rootroot00000000000000 ]> canonicalform05

      &ent1;, &ent2;!

      jsdom-19.0.0/test/to-port-to-wpts/level3/core/files/orig/datatype_normalization.svg000066400000000000000000000055421415223704400304110ustar00rootroot00000000000000 ]> -31415926.00E-7 2.718 INF -INF -0 false true false 0 1 0 +10 .1 -.001 -31415926.00E-7 2.718 INF -INF -0 2004-01-21T15:30:00 2004-01-21T15:30:00Z 2004-01-21T15:30:00.0000 2004-01-21T15:30:00.0001 jsdom-19.0.0/test/to-port-to-wpts/level3/core/files/orig/datatype_normalization.svg.xsd000066400000000000000000000036501415223704400312040ustar00rootroot00000000000000 jsdom-19.0.0/test/to-port-to-wpts/level3/core/files/orig/datatype_normalization.xml000066400000000000000000000055431415223704400304130ustar00rootroot00000000000000 ]> -31415926.00E-7 2.718 INF -INF -0 false true false 0 1 0 +10 .1 -.001 -31415926.00E-7 2.718 INF -INF -0 2004-01-21T15:30:00 2004-01-21T15:30:00Z 2004-01-21T15:30:00.0000 2004-01-21T15:30:00.0001 jsdom-19.0.0/test/to-port-to-wpts/level3/core/files/orig/datatype_normalization.xsd000066400000000000000000000150641415223704400304100ustar00rootroot00000000000000 jsdom-19.0.0/test/to-port-to-wpts/level3/core/files/orig/datatype_normalization2.svg000066400000000000000000000023731415223704400304720ustar00rootroot00000000000000 ]>

      EMP 0001 EMP 0001 EMP 0001 EMP 0001 EMP 0001 EMP 0001 EMP 0001 EMP 0001 EMP 0001

      jsdom-19.0.0/test/to-port-to-wpts/level3/core/files/orig/datatype_normalization2.svg.xsd000066400000000000000000000035331415223704400312660ustar00rootroot00000000000000 jsdom-19.0.0/test/to-port-to-wpts/level3/core/files/orig/datatype_normalization2.xhtml000066400000000000000000000017241415223704400310260ustar00rootroot00000000000000 ]> datatype_normalization2

      EMP 0001 EMP 0001 EMP 0001 EMP 0001 EMP 0001 EMP 0001 EMP 0001 EMP 0001 EMP 0001

      jsdom-19.0.0/test/to-port-to-wpts/level3/core/files/orig/datatype_normalization2.xml000066400000000000000000000017241415223704400304720ustar00rootroot00000000000000 ]> datatype_normalization2

      EMP 0001 EMP 0001 EMP 0001 EMP 0001 EMP 0001 EMP 0001 EMP 0001 EMP 0001 EMP 0001

      jsdom-19.0.0/test/to-port-to-wpts/level3/core/files/orig/datatype_normalization2.xsd000066400000000000000000000053531415223704400304720ustar00rootroot00000000000000 jsdom-19.0.0/test/to-port-to-wpts/level3/core/files/orig/external_barfoo.svg000066400000000000000000000020641415223704400267760ustar00rootroot00000000000000 ]>

      bar&ent2;&ent1;

      bar&ent2;&ent1;

      &ent3; jsdom-19.0.0/test/to-port-to-wpts/level3/core/files/orig/external_barfoo.xhtml000066400000000000000000000017221415223704400273330ustar00rootroot00000000000000 ]> external entity encoding sample

      bar&ent2;&ent1;

      bar&ent2;&ent1;

      &ent3; jsdom-19.0.0/test/to-port-to-wpts/level3/core/files/orig/external_barfoo.xml000066400000000000000000000017221415223704400267770ustar00rootroot00000000000000 ]> external entity encoding sample

      bar&ent2;&ent1;

      bar&ent2;&ent1;

      &ent3; jsdom-19.0.0/test/to-port-to-wpts/level3/core/files/orig/external_foo.ent000066400000000000000000000001261415223704400262750ustar00rootroot00000000000000<?xml version="1.0" encoding="uTf-16"?>foojsdom-19.0.0/test/to-port-to-wpts/level3/core/files/orig/external_foobr.ent000066400000000000000000000000101415223704400266110ustar00rootroot00000000000000
      foojsdom-19.0.0/test/to-port-to-wpts/level3/core/files/orig/external_widget.ent000066400000000000000000000000631415223704400267750ustar00rootroot00000000000000

      widget

      jsdom-19.0.0/test/to-port-to-wpts/level3/core/files/orig/hc_nodtdstaff.html000066400000000000000000000004541415223704400266000ustar00rootroot00000000000000hc_nodtdstaff

      EMP0001 Margaret Martin Accountant 56,000 Female 1230 North Ave. Dallas, Texas 98551

      jsdom-19.0.0/test/to-port-to-wpts/level3/core/files/orig/hc_nodtdstaff.html.1000066400000000000000000000004541415223704400267370ustar00rootroot00000000000000hc_nodtdstaff

      EMP0001 Margaret Martin Accountant 56,000 Female 1230 North Ave. Dallas, Texas 98551

      jsdom-19.0.0/test/to-port-to-wpts/level3/core/files/orig/hc_nodtdstaff.svg000066400000000000000000000006571415223704400264400ustar00rootroot00000000000000hc_nodtdstaff

      EMP0001 Margaret Martin Accountant 56,000 Female 1230 North Ave. Dallas, Texas 98551

      jsdom-19.0.0/test/to-port-to-wpts/level3/core/files/orig/hc_nodtdstaff.xhtml000066400000000000000000000005211415223704400267630ustar00rootroot00000000000000hc_nodtdstaff

      EMP0001 Margaret Martin Accountant 56,000 Female 1230 North Ave. Dallas, Texas 98551

      jsdom-19.0.0/test/to-port-to-wpts/level3/core/files/orig/hc_nodtdstaff.xml000066400000000000000000000005211415223704400264270ustar00rootroot00000000000000hc_nodtdstaff

      EMP0001 Margaret Martin Accountant 56,000 Female 1230 North Ave. Dallas, Texas 98551

      jsdom-19.0.0/test/to-port-to-wpts/level3/core/files/orig/hc_staff.svg000066400000000000000000000061641415223704400254060ustar00rootroot00000000000000 Element data"> ]>

      EMP0001 Margaret Martin Accountant 56,000 Female 1230 North Ave. Dallas, Texas 98551

      EMP0002 Martha Raynolds Secretary 35,000 Female β Dallas, γ 98554

      EMP0003 Roger Jones Department Manager 100,000 &ent4; PO Box 27 Irving, texas 98553

      EMP0004 Jeny Oconnor Personnel Director 95,000 Female 27 South Road. Dallas, Texas 98556

      EMP0005 Robert Myers Computer Specialist 90,000 male 1821 Nordic. Road, Irving Texas 98558

      jsdom-19.0.0/test/to-port-to-wpts/level3/core/files/orig/hc_staff.svg.xsd000066400000000000000000000035141415223704400261770ustar00rootroot00000000000000 jsdom-19.0.0/test/to-port-to-wpts/level3/core/files/orig/hc_staff.xhtml000066400000000000000000000056731415223704400257470ustar00rootroot00000000000000 Element data"> ]> hc_staff

      EMP0001 Margaret Martin Accountant 56,000 Female 1230 North Ave. Dallas, Texas 98551

      EMP0002 Martha Raynolds Secretary 35,000 Female β Dallas, γ 98554

      EMP0003 Roger Jones Department Manager 100,000 &ent4; PO Box 27 Irving, texas 98553

      EMP0004 Jeny Oconnor Personnel Director 95,000 Female 27 South Road. Dallas, Texas 98556

      EMP0005 Robert Myers Computer Specialist 90,000 male 1821 Nordic. Road, Irving Texas 98558

      jsdom-19.0.0/test/to-port-to-wpts/level3/core/files/orig/hc_staff.xml000066400000000000000000000056731415223704400254130ustar00rootroot00000000000000 Element data"> ]> hc_staff

      EMP0001 Margaret Martin Accountant 56,000 Female 1230 North Ave. Dallas, Texas 98551

      EMP0002 Martha Raynolds Secretary 35,000 Female β Dallas, γ 98554

      EMP0003 Roger Jones Department Manager 100,000 &ent4; PO Box 27 Irving, texas 98553

      EMP0004 Jeny Oconnor Personnel Director 95,000 Female 27 South Road. Dallas, Texas 98556

      EMP0005 Robert Myers Computer Specialist 90,000 male 1821 Nordic. Road, Irving Texas 98558

      jsdom-19.0.0/test/to-port-to-wpts/level3/core/files/orig/hc_staff.xsd000066400000000000000000000166751415223704400254150ustar00rootroot00000000000000 jsdom-19.0.0/test/to-port-to-wpts/level3/core/files/orig/image2.gif000066400000000000000000000004651415223704400247410ustar00rootroot00000000000000GIF89a33̙ffff33333f!NThis art is in the public domain. Kevin Hughes, kevinh@eit.com, September 1995!,IXGvm^IYv*:A,6k-Ő6KX5T%8kV b4j i e,|y7W/+fz%~w %PO@IR;jsdom-19.0.0/test/to-port-to-wpts/level3/core/files/orig/index.CDOA.html000066400000000000000000000450011415223704400256030ustar00rootroot00000000000000 Index of /2004/04/ecmascript/level3/core/files

      Index of /2004/04/ecmascript/level3/core/files

      [ICO]NameLast modifiedSizeDescription

      [DIR]Parent Directory  -  
      [IMG]barfoo.svg05-Apr-2004 14:48 794  
      [   ]barfoo.xhtml05-Apr-2004 14:48 609  
      [   ]barfoo.xml05-Apr-2004 14:48 584  
      [IMG]barfoo_base.svg05-Apr-2004 14:48 1.2K 
      [   ]barfoo_base.xhtml05-Apr-2004 14:48 807  
      [   ]barfoo_base.xml05-Apr-2004 14:48 778  
      [IMG]barfoo_nodefaultns.svg05-Apr-2004 14:48 1.0K 
      [   ]barfoo_nodefaultns.xhtml05-Apr-2004 14:48 793  
      [   ]barfoo_nodefaultns.xml05-Apr-2004 14:48 767  
      [IMG]barfoo_standalone_no.svg05-Apr-2004 14:48 850  
      [   ]barfoo_standalone_no.xhtml05-Apr-2004 14:48 665  
      [   ]barfoo_standalone_no.xml05-Apr-2004 14:48 639  
      [IMG]barfoo_standalone_yes.svg05-Apr-2004 14:48 634  
      [   ]barfoo_standalone_yes.xhtml05-Apr-2004 14:48 668  
      [   ]barfoo_standalone_yes.xml05-Apr-2004 14:48 642  
      [IMG]barfoo_utf8.svg05-Apr-2004 14:48 944  
      [   ]barfoo_utf8.xhtml05-Apr-2004 14:48 745  
      [   ]barfoo_utf8.xml05-Apr-2004 14:48 717  
      [IMG]barfoo_utf16.svg05-Apr-2004 14:48 1.8K 
      [   ]barfoo_utf16.xhtml05-Apr-2004 14:48 1.1K 
      [   ]barfoo_utf16.xml05-Apr-2004 14:48 1.2K 
      [IMG]canonicalform01.svg05-Apr-2004 14:48 536  
      [   ]canonicalform01.xhtml05-Apr-2004 14:48 382  
      [   ]canonicalform01.xml05-Apr-2004 14:48 368  
      [IMG]canonicalform02.svg05-Apr-2004 14:48 490  
      [   ]canonicalform02.xhtml05-Apr-2004 14:48 295  
      [   ]canonicalform02.xml05-Apr-2004 14:48 284  
      [IMG]canonicalform03.svg05-Apr-2004 14:48 916  
      [   ]canonicalform03.xhtml05-Apr-2004 14:48 737  
      [   ]canonicalform03.xml05-Apr-2004 14:48 719  
      [IMG]canonicalform04.svg05-Apr-2004 14:48 784  
      [   ]canonicalform04.xhtml05-Apr-2004 14:48 634  
      [   ]canonicalform04.xml05-Apr-2004 14:48 621  
      [IMG]canonicalform05.svg05-Apr-2004 14:48 611  
      [   ]canonicalform05.xhtml05-Apr-2004 14:48 462  
      [   ]canonicalform05.xml05-Apr-2004 14:48 449  
      [IMG]datatype_normalization.svg05-Apr-2004 14:48 2.9K 
      [   ]datatype_normalization.svg.xsd05-Apr-2004 14:48 2.0K 
      [   ]datatype_normalization.xml05-Apr-2004 14:48 2.8K 
      [   ]datatype_normalization.xsd05-Apr-2004 14:48 6.8K 
      [IMG]datatype_normalization2.svg05-Apr-2004 14:48 1.3K 
      [   ]datatype_normalization2.svg.xsd05-Apr-2004 14:48 1.9K 
      [   ]datatype_normalization2.xhtml05-Apr-2004 14:48 1.0K 
      [   ]datatype_normalization2.xml05-Apr-2004 14:48 1.0K 
      [   ]datatype_normalization2.xsd05-Apr-2004 14:48 2.8K 
      [IMG]external_barfoo.svg05-Apr-2004 14:48 1.1K 
      [   ]external_barfoo.xhtml05-Apr-2004 14:48 1.0K 
      [   ]external_barfoo.xml05-Apr-2004 14:48 1.0K 
      [   ]external_foo.ent05-Apr-2004 14:48 86  
      [   ]external_foobr.ent05-Apr-2004 14:48 8  
      [   ]external_widget.ent05-Apr-2004 14:48 52  
      [IMG]hc_nodtdstaff.svg05-Apr-2004 14:48 441  
      [   ]hc_nodtdstaff.xhtml05-Apr-2004 14:48 347  
      [   ]hc_nodtdstaff.xml05-Apr-2004 14:48 337  
      [IMG]hc_staff.svg05-Apr-2004 14:48 3.2K 
      [   ]hc_staff.svg.xsd05-Apr-2004 14:48 1.9K 
      [   ]hc_staff.xhtml05-Apr-2004 14:48 3.0K 
      [   ]hc_staff.xml05-Apr-2004 14:48 2.9K 
      [   ]hc_staff.xsd05-Apr-2004 14:48 7.7K 
      [   ]svgtest.js05-Apr-2004 14:48 0  
      [   ]svgunit.js05-Apr-2004 14:48 0  
      [IMG]typeinfo.svg05-Apr-2004 14:48 1.1K 
      [   ]typeinfo.svg.xsd05-Apr-2004 14:48 1.9K 
      [   ]typeinfo.xhtml05-Apr-2004 14:48 830  
      [   ]typeinfo.xml05-Apr-2004 14:48 812  
      [   ]typeinfo.xsd05-Apr-2004 14:48 3.2K 
      [   ]xhtml-lat1.ent05-Apr-2004 14:48 11K 
      [   ]xhtml-special.ent05-Apr-2004 14:48 4.0K 
      [   ]xhtml-symbol.ent05-Apr-2004 14:48 14K 
      [TXT]xhtml1-frameset.dtd07-Apr-2004 18:09 32K 
      [TXT]xhtml1-strict.dtd05-Apr-2004 14:48 1.8K 
      [TXT]xhtml1-transitional.dtd07-Apr-2004 18:09 31K 
      [   ]Yes05-Apr-2004 14:48 1.0K 
      [TXT]hc_nodtdstaff.html05-Apr-2004 14:48 300 hc_nodtdstaff

      jsdom-19.0.0/test/to-port-to-wpts/level3/core/files/orig/index.CMOA.html000066400000000000000000000450011415223704400256140ustar00rootroot00000000000000 Index of /2004/04/ecmascript/level3/core/files

      Index of /2004/04/ecmascript/level3/core/files

      [ICO]NameLast modifiedSizeDescription

      [DIR]Parent Directory  -  
      [IMG]barfoo.svg05-Apr-2004 14:48 794  
      [   ]barfoo.xhtml05-Apr-2004 14:48 609  
      [   ]barfoo.xml05-Apr-2004 14:48 584  
      [IMG]barfoo_base.svg05-Apr-2004 14:48 1.2K 
      [   ]barfoo_base.xhtml05-Apr-2004 14:48 807  
      [   ]barfoo_base.xml05-Apr-2004 14:48 778  
      [IMG]barfoo_nodefaultns.svg05-Apr-2004 14:48 1.0K 
      [   ]barfoo_nodefaultns.xhtml05-Apr-2004 14:48 793  
      [   ]barfoo_nodefaultns.xml05-Apr-2004 14:48 767  
      [IMG]barfoo_standalone_no.svg05-Apr-2004 14:48 850  
      [   ]barfoo_standalone_no.xhtml05-Apr-2004 14:48 665  
      [   ]barfoo_standalone_no.xml05-Apr-2004 14:48 639  
      [IMG]barfoo_standalone_yes.svg05-Apr-2004 14:48 634  
      [   ]barfoo_standalone_yes.xhtml05-Apr-2004 14:48 668  
      [   ]barfoo_standalone_yes.xml05-Apr-2004 14:48 642  
      [IMG]barfoo_utf8.svg05-Apr-2004 14:48 944  
      [   ]barfoo_utf8.xhtml05-Apr-2004 14:48 745  
      [   ]barfoo_utf8.xml05-Apr-2004 14:48 717  
      [IMG]barfoo_utf16.svg05-Apr-2004 14:48 1.8K 
      [   ]barfoo_utf16.xhtml05-Apr-2004 14:48 1.1K 
      [   ]barfoo_utf16.xml05-Apr-2004 14:48 1.2K 
      [IMG]canonicalform01.svg05-Apr-2004 14:48 536  
      [   ]canonicalform01.xhtml05-Apr-2004 14:48 382  
      [   ]canonicalform01.xml05-Apr-2004 14:48 368  
      [IMG]canonicalform02.svg05-Apr-2004 14:48 490  
      [   ]canonicalform02.xhtml05-Apr-2004 14:48 295  
      [   ]canonicalform02.xml05-Apr-2004 14:48 284  
      [IMG]canonicalform03.svg05-Apr-2004 14:48 916  
      [   ]canonicalform03.xhtml05-Apr-2004 14:48 737  
      [   ]canonicalform03.xml05-Apr-2004 14:48 719  
      [IMG]canonicalform04.svg05-Apr-2004 14:48 784  
      [   ]canonicalform04.xhtml05-Apr-2004 14:48 634  
      [   ]canonicalform04.xml05-Apr-2004 14:48 621  
      [IMG]canonicalform05.svg05-Apr-2004 14:48 611  
      [   ]canonicalform05.xhtml05-Apr-2004 14:48 462  
      [   ]canonicalform05.xml05-Apr-2004 14:48 449  
      [IMG]datatype_normalization.svg05-Apr-2004 14:48 2.9K 
      [   ]datatype_normalization.svg.xsd05-Apr-2004 14:48 2.0K 
      [   ]datatype_normalization.xml05-Apr-2004 14:48 2.8K 
      [   ]datatype_normalization.xsd05-Apr-2004 14:48 6.8K 
      [IMG]datatype_normalization2.svg05-Apr-2004 14:48 1.3K 
      [   ]datatype_normalization2.svg.xsd05-Apr-2004 14:48 1.9K 
      [   ]datatype_normalization2.xhtml05-Apr-2004 14:48 1.0K 
      [   ]datatype_normalization2.xml05-Apr-2004 14:48 1.0K 
      [   ]datatype_normalization2.xsd05-Apr-2004 14:48 2.8K 
      [IMG]external_barfoo.svg05-Apr-2004 14:48 1.1K 
      [   ]external_barfoo.xhtml05-Apr-2004 14:48 1.0K 
      [   ]external_barfoo.xml05-Apr-2004 14:48 1.0K 
      [   ]external_foo.ent05-Apr-2004 14:48 86  
      [   ]external_foobr.ent05-Apr-2004 14:48 8  
      [   ]external_widget.ent05-Apr-2004 14:48 52  
      [TXT]hc_nodtdstaff.html05-Apr-2004 14:48 300 hc_nodtdstaff
      [IMG]hc_nodtdstaff.svg05-Apr-2004 14:48 441  
      [   ]hc_nodtdstaff.xhtml05-Apr-2004 14:48 347  
      [   ]hc_nodtdstaff.xml05-Apr-2004 14:48 337  
      [IMG]hc_staff.svg05-Apr-2004 14:48 3.2K 
      [   ]hc_staff.svg.xsd05-Apr-2004 14:48 1.9K 
      [   ]hc_staff.xhtml05-Apr-2004 14:48 3.0K 
      [   ]hc_staff.xml05-Apr-2004 14:48 2.9K 
      [   ]hc_staff.xsd05-Apr-2004 14:48 7.7K 
      [   ]svgtest.js05-Apr-2004 14:48 0  
      [   ]svgunit.js05-Apr-2004 14:48 0  
      [IMG]typeinfo.svg05-Apr-2004 14:48 1.1K 
      [   ]typeinfo.svg.xsd05-Apr-2004 14:48 1.9K 
      [   ]typeinfo.xhtml05-Apr-2004 14:48 830  
      [   ]typeinfo.xml05-Apr-2004 14:48 812  
      [   ]typeinfo.xsd05-Apr-2004 14:48 3.2K 
      [   ]xhtml-lat1.ent05-Apr-2004 14:48 11K 
      [   ]xhtml-special.ent05-Apr-2004 14:48 4.0K 
      [   ]xhtml-symbol.ent05-Apr-2004 14:48 14K 
      [TXT]xhtml1-strict.dtd05-Apr-2004 14:48 1.8K 
      [   ]Yes05-Apr-2004 14:48 1.0K 
      [TXT]xhtml1-frameset.dtd07-Apr-2004 18:09 32K 
      [TXT]xhtml1-transitional.dtd07-Apr-2004 18:09 31K 

      jsdom-19.0.0/test/to-port-to-wpts/level3/core/files/orig/index.CNOD.html000066400000000000000000000450011415223704400256200ustar00rootroot00000000000000 Index of /2004/04/ecmascript/level3/core/files

      Index of /2004/04/ecmascript/level3/core/files

      [ICO]NameLast modifiedSizeDescription

      [DIR]Parent Directory  -  
      [   ]Yes05-Apr-2004 14:48 1.0K 
      [TXT]xhtml1-transitional.dtd07-Apr-2004 18:09 31K 
      [TXT]xhtml1-strict.dtd05-Apr-2004 14:48 1.8K 
      [TXT]xhtml1-frameset.dtd07-Apr-2004 18:09 32K 
      [   ]xhtml-symbol.ent05-Apr-2004 14:48 14K 
      [   ]xhtml-special.ent05-Apr-2004 14:48 4.0K 
      [   ]xhtml-lat1.ent05-Apr-2004 14:48 11K 
      [   ]typeinfo.xsd05-Apr-2004 14:48 3.2K 
      [   ]typeinfo.xml05-Apr-2004 14:48 812  
      [   ]typeinfo.xhtml05-Apr-2004 14:48 830  
      [   ]typeinfo.svg.xsd05-Apr-2004 14:48 1.9K 
      [IMG]typeinfo.svg05-Apr-2004 14:48 1.1K 
      [   ]svgunit.js05-Apr-2004 14:48 0  
      [   ]svgtest.js05-Apr-2004 14:48 0  
      [   ]hc_staff.xsd05-Apr-2004 14:48 7.7K 
      [   ]hc_staff.xml05-Apr-2004 14:48 2.9K 
      [   ]hc_staff.xhtml05-Apr-2004 14:48 3.0K 
      [   ]hc_staff.svg.xsd05-Apr-2004 14:48 1.9K 
      [IMG]hc_staff.svg05-Apr-2004 14:48 3.2K 
      [   ]hc_nodtdstaff.xml05-Apr-2004 14:48 337  
      [   ]hc_nodtdstaff.xhtml05-Apr-2004 14:48 347  
      [IMG]hc_nodtdstaff.svg05-Apr-2004 14:48 441  
      [TXT]hc_nodtdstaff.html05-Apr-2004 14:48 300 hc_nodtdstaff
      [   ]external_widget.ent05-Apr-2004 14:48 52  
      [   ]external_foobr.ent05-Apr-2004 14:48 8  
      [   ]external_foo.ent05-Apr-2004 14:48 86  
      [   ]external_barfoo.xml05-Apr-2004 14:48 1.0K 
      [   ]external_barfoo.xhtml05-Apr-2004 14:48 1.0K 
      [IMG]external_barfoo.svg05-Apr-2004 14:48 1.1K 
      [   ]datatype_normalization2.xsd05-Apr-2004 14:48 2.8K 
      [   ]datatype_normalization2.xml05-Apr-2004 14:48 1.0K 
      [   ]datatype_normalization2.xhtml05-Apr-2004 14:48 1.0K 
      [   ]datatype_normalization2.svg.xsd05-Apr-2004 14:48 1.9K 
      [IMG]datatype_normalization2.svg05-Apr-2004 14:48 1.3K 
      [   ]datatype_normalization.xsd05-Apr-2004 14:48 6.8K 
      [   ]datatype_normalization.xml05-Apr-2004 14:48 2.8K 
      [   ]datatype_normalization.svg.xsd05-Apr-2004 14:48 2.0K 
      [IMG]datatype_normalization.svg05-Apr-2004 14:48 2.9K 
      [   ]canonicalform05.xml05-Apr-2004 14:48 449  
      [   ]canonicalform05.xhtml05-Apr-2004 14:48 462  
      [IMG]canonicalform05.svg05-Apr-2004 14:48 611  
      [   ]canonicalform04.xml05-Apr-2004 14:48 621  
      [   ]canonicalform04.xhtml05-Apr-2004 14:48 634  
      [IMG]canonicalform04.svg05-Apr-2004 14:48 784  
      [   ]canonicalform03.xml05-Apr-2004 14:48 719  
      [   ]canonicalform03.xhtml05-Apr-2004 14:48 737  
      [IMG]canonicalform03.svg05-Apr-2004 14:48 916  
      [   ]canonicalform02.xml05-Apr-2004 14:48 284  
      [   ]canonicalform02.xhtml05-Apr-2004 14:48 295  
      [IMG]canonicalform02.svg05-Apr-2004 14:48 490  
      [   ]canonicalform01.xml05-Apr-2004 14:48 368  
      [   ]canonicalform01.xhtml05-Apr-2004 14:48 382  
      [IMG]canonicalform01.svg05-Apr-2004 14:48 536  
      [   ]barfoo_utf16.xml05-Apr-2004 14:48 1.2K 
      [   ]barfoo_utf16.xhtml05-Apr-2004 14:48 1.1K 
      [IMG]barfoo_utf16.svg05-Apr-2004 14:48 1.8K 
      [   ]barfoo_utf8.xml05-Apr-2004 14:48 717  
      [   ]barfoo_utf8.xhtml05-Apr-2004 14:48 745  
      [IMG]barfoo_utf8.svg05-Apr-2004 14:48 944  
      [   ]barfoo_standalone_yes.xml05-Apr-2004 14:48 642  
      [   ]barfoo_standalone_yes.xhtml05-Apr-2004 14:48 668  
      [IMG]barfoo_standalone_yes.svg05-Apr-2004 14:48 634  
      [   ]barfoo_standalone_no.xml05-Apr-2004 14:48 639  
      [   ]barfoo_standalone_no.xhtml05-Apr-2004 14:48 665  
      [IMG]barfoo_standalone_no.svg05-Apr-2004 14:48 850  
      [   ]barfoo_nodefaultns.xml05-Apr-2004 14:48 767  
      [   ]barfoo_nodefaultns.xhtml05-Apr-2004 14:48 793  
      [IMG]barfoo_nodefaultns.svg05-Apr-2004 14:48 1.0K 
      [   ]barfoo_base.xml05-Apr-2004 14:48 778  
      [   ]barfoo_base.xhtml05-Apr-2004 14:48 807  
      [IMG]barfoo_base.svg05-Apr-2004 14:48 1.2K 
      [   ]barfoo.xml05-Apr-2004 14:48 584  
      [   ]barfoo.xhtml05-Apr-2004 14:48 609  
      [IMG]barfoo.svg05-Apr-2004 14:48 794  

      jsdom-19.0.0/test/to-port-to-wpts/level3/core/files/orig/index.CSOA.html000066400000000000000000000450011415223704400256220ustar00rootroot00000000000000 Index of /2004/04/ecmascript/level3/core/files

      Index of /2004/04/ecmascript/level3/core/files

      [ICO]NameLast modifiedSizeDescription

      [DIR]Parent Directory  -  
      [   ]svgtest.js05-Apr-2004 14:48 0  
      [   ]svgunit.js05-Apr-2004 14:48 0  
      [   ]external_foobr.ent05-Apr-2004 14:48 8  
      [   ]external_widget.ent05-Apr-2004 14:48 52  
      [   ]external_foo.ent05-Apr-2004 14:48 86  
      [   ]canonicalform02.xml05-Apr-2004 14:48 284  
      [   ]canonicalform02.xhtml05-Apr-2004 14:48 295  
      [TXT]hc_nodtdstaff.html05-Apr-2004 14:48 300 hc_nodtdstaff
      [   ]hc_nodtdstaff.xml05-Apr-2004 14:48 337  
      [   ]hc_nodtdstaff.xhtml05-Apr-2004 14:48 347  
      [   ]canonicalform01.xml05-Apr-2004 14:48 368  
      [   ]canonicalform01.xhtml05-Apr-2004 14:48 382  
      [IMG]hc_nodtdstaff.svg05-Apr-2004 14:48 441  
      [   ]canonicalform05.xml05-Apr-2004 14:48 449  
      [   ]canonicalform05.xhtml05-Apr-2004 14:48 462  
      [IMG]canonicalform02.svg05-Apr-2004 14:48 490  
      [IMG]canonicalform01.svg05-Apr-2004 14:48 536  
      [   ]barfoo.xml05-Apr-2004 14:48 584  
      [   ]barfoo.xhtml05-Apr-2004 14:48 609  
      [IMG]canonicalform05.svg05-Apr-2004 14:48 611  
      [   ]canonicalform04.xml05-Apr-2004 14:48 621  
      [IMG]barfoo_standalone_yes.svg05-Apr-2004 14:48 634  
      [   ]canonicalform04.xhtml05-Apr-2004 14:48 634  
      [   ]barfoo_standalone_no.xml05-Apr-2004 14:48 639  
      [   ]barfoo_standalone_yes.xml05-Apr-2004 14:48 642  
      [   ]barfoo_standalone_no.xhtml05-Apr-2004 14:48 665  
      [   ]barfoo_standalone_yes.xhtml05-Apr-2004 14:48 668  
      [   ]barfoo_utf8.xml05-Apr-2004 14:48 717  
      [   ]canonicalform03.xml05-Apr-2004 14:48 719  
      [   ]canonicalform03.xhtml05-Apr-2004 14:48 737  
      [   ]barfoo_utf8.xhtml05-Apr-2004 14:48 745  
      [   ]barfoo_nodefaultns.xml05-Apr-2004 14:48 767  
      [   ]barfoo_base.xml05-Apr-2004 14:48 778  
      [IMG]canonicalform04.svg05-Apr-2004 14:48 784  
      [   ]barfoo_nodefaultns.xhtml05-Apr-2004 14:48 793  
      [IMG]barfoo.svg05-Apr-2004 14:48 794  
      [   ]barfoo_base.xhtml05-Apr-2004 14:48 807  
      [   ]typeinfo.xml05-Apr-2004 14:48 812  
      [   ]typeinfo.xhtml05-Apr-2004 14:48 830  
      [IMG]barfoo_standalone_no.svg05-Apr-2004 14:48 850  
      [IMG]canonicalform03.svg05-Apr-2004 14:48 916  
      [IMG]barfoo_utf8.svg05-Apr-2004 14:48 944  
      [   ]external_barfoo.xml05-Apr-2004 14:48 1.0K 
      [   ]datatype_normalization2.xml05-Apr-2004 14:48 1.0K 
      [IMG]barfoo_nodefaultns.svg05-Apr-2004 14:48 1.0K 
      [   ]Yes05-Apr-2004 14:48 1.0K 
      [   ]external_barfoo.xhtml05-Apr-2004 14:48 1.0K 
      [   ]datatype_normalization2.xhtml05-Apr-2004 14:48 1.0K 
      [   ]barfoo_utf16.xhtml05-Apr-2004 14:48 1.1K 
      [IMG]typeinfo.svg05-Apr-2004 14:48 1.1K 
      [IMG]external_barfoo.svg05-Apr-2004 14:48 1.1K 
      [IMG]barfoo_base.svg05-Apr-2004 14:48 1.2K 
      [   ]barfoo_utf16.xml05-Apr-2004 14:48 1.2K 
      [IMG]datatype_normalization2.svg05-Apr-2004 14:48 1.3K 
      [TXT]xhtml1-strict.dtd05-Apr-2004 14:48 1.8K 
      [IMG]barfoo_utf16.svg05-Apr-2004 14:48 1.8K 
      [   ]hc_staff.svg.xsd05-Apr-2004 14:48 1.9K 
      [   ]typeinfo.svg.xsd05-Apr-2004 14:48 1.9K 
      [   ]datatype_normalization2.svg.xsd05-Apr-2004 14:48 1.9K 
      [   ]datatype_normalization.svg.xsd05-Apr-2004 14:48 2.0K 
      [   ]datatype_normalization2.xsd05-Apr-2004 14:48 2.8K 
      [   ]datatype_normalization.xml05-Apr-2004 14:48 2.8K 
      [IMG]datatype_normalization.svg05-Apr-2004 14:48 2.9K 
      [   ]hc_staff.xml05-Apr-2004 14:48 2.9K 
      [   ]hc_staff.xhtml05-Apr-2004 14:48 3.0K 
      [   ]typeinfo.xsd05-Apr-2004 14:48 3.2K 
      [IMG]hc_staff.svg05-Apr-2004 14:48 3.2K 
      [   ]xhtml-special.ent05-Apr-2004 14:48 4.0K 
      [   ]datatype_normalization.xsd05-Apr-2004 14:48 6.8K 
      [   ]hc_staff.xsd05-Apr-2004 14:48 7.7K 
      [   ]xhtml-lat1.ent05-Apr-2004 14:48 11K 
      [   ]xhtml-symbol.ent05-Apr-2004 14:48 14K 
      [TXT]xhtml1-transitional.dtd07-Apr-2004 18:09 31K 
      [TXT]xhtml1-frameset.dtd07-Apr-2004 18:09 32K 

      jsdom-19.0.0/test/to-port-to-wpts/level3/core/files/orig/index.html000066400000000000000000000450011415223704400250760ustar00rootroot00000000000000 Index of /2004/04/ecmascript/level3/core/files

      Index of /2004/04/ecmascript/level3/core/files

      [ICO]NameLast modifiedSizeDescription

      [DIR]Parent Directory  -  
      [IMG]barfoo.svg05-Apr-2004 14:48 794  
      [   ]barfoo.xhtml05-Apr-2004 14:48 609  
      [   ]barfoo.xml05-Apr-2004 14:48 584  
      [IMG]barfoo_base.svg05-Apr-2004 14:48 1.2K 
      [   ]barfoo_base.xhtml05-Apr-2004 14:48 807  
      [   ]barfoo_base.xml05-Apr-2004 14:48 778  
      [IMG]barfoo_nodefaultns.svg05-Apr-2004 14:48 1.0K 
      [   ]barfoo_nodefaultns.xhtml05-Apr-2004 14:48 793  
      [   ]barfoo_nodefaultns.xml05-Apr-2004 14:48 767  
      [IMG]barfoo_standalone_no.svg05-Apr-2004 14:48 850  
      [   ]barfoo_standalone_no.xhtml05-Apr-2004 14:48 665  
      [   ]barfoo_standalone_no.xml05-Apr-2004 14:48 639  
      [IMG]barfoo_standalone_yes.svg05-Apr-2004 14:48 634  
      [   ]barfoo_standalone_yes.xhtml05-Apr-2004 14:48 668  
      [   ]barfoo_standalone_yes.xml05-Apr-2004 14:48 642  
      [IMG]barfoo_utf8.svg05-Apr-2004 14:48 944  
      [   ]barfoo_utf8.xhtml05-Apr-2004 14:48 745  
      [   ]barfoo_utf8.xml05-Apr-2004 14:48 717  
      [IMG]barfoo_utf16.svg05-Apr-2004 14:48 1.8K 
      [   ]barfoo_utf16.xhtml05-Apr-2004 14:48 1.1K 
      [   ]barfoo_utf16.xml05-Apr-2004 14:48 1.2K 
      [IMG]canonicalform01.svg05-Apr-2004 14:48 536  
      [   ]canonicalform01.xhtml05-Apr-2004 14:48 382  
      [   ]canonicalform01.xml05-Apr-2004 14:48 368  
      [IMG]canonicalform02.svg05-Apr-2004 14:48 490  
      [   ]canonicalform02.xhtml05-Apr-2004 14:48 295  
      [   ]canonicalform02.xml05-Apr-2004 14:48 284  
      [IMG]canonicalform03.svg05-Apr-2004 14:48 916  
      [   ]canonicalform03.xhtml05-Apr-2004 14:48 737  
      [   ]canonicalform03.xml05-Apr-2004 14:48 719  
      [IMG]canonicalform04.svg05-Apr-2004 14:48 784  
      [   ]canonicalform04.xhtml05-Apr-2004 14:48 634  
      [   ]canonicalform04.xml05-Apr-2004 14:48 621  
      [IMG]canonicalform05.svg05-Apr-2004 14:48 611  
      [   ]canonicalform05.xhtml05-Apr-2004 14:48 462  
      [   ]canonicalform05.xml05-Apr-2004 14:48 449  
      [IMG]datatype_normalization.svg05-Apr-2004 14:48 2.9K 
      [   ]datatype_normalization.svg.xsd05-Apr-2004 14:48 2.0K 
      [   ]datatype_normalization.xml05-Apr-2004 14:48 2.8K 
      [   ]datatype_normalization.xsd05-Apr-2004 14:48 6.8K 
      [IMG]datatype_normalization2.svg05-Apr-2004 14:48 1.3K 
      [   ]datatype_normalization2.svg.xsd05-Apr-2004 14:48 1.9K 
      [   ]datatype_normalization2.xhtml05-Apr-2004 14:48 1.0K 
      [   ]datatype_normalization2.xml05-Apr-2004 14:48 1.0K 
      [   ]datatype_normalization2.xsd05-Apr-2004 14:48 2.8K 
      [IMG]external_barfoo.svg05-Apr-2004 14:48 1.1K 
      [   ]external_barfoo.xhtml05-Apr-2004 14:48 1.0K 
      [   ]external_barfoo.xml05-Apr-2004 14:48 1.0K 
      [   ]external_foo.ent05-Apr-2004 14:48 86  
      [   ]external_foobr.ent05-Apr-2004 14:48 8  
      [   ]external_widget.ent05-Apr-2004 14:48 52  
      [TXT]hc_nodtdstaff.html05-Apr-2004 14:48 300 hc_nodtdstaff
      [IMG]hc_nodtdstaff.svg05-Apr-2004 14:48 441  
      [   ]hc_nodtdstaff.xhtml05-Apr-2004 14:48 347  
      [   ]hc_nodtdstaff.xml05-Apr-2004 14:48 337  
      [IMG]hc_staff.svg05-Apr-2004 14:48 3.2K 
      [   ]hc_staff.svg.xsd05-Apr-2004 14:48 1.9K 
      [   ]hc_staff.xhtml05-Apr-2004 14:48 3.0K 
      [   ]hc_staff.xml05-Apr-2004 14:48 2.9K 
      [   ]hc_staff.xsd05-Apr-2004 14:48 7.7K 
      [   ]svgtest.js05-Apr-2004 14:48 0  
      [   ]svgunit.js05-Apr-2004 14:48 0  
      [IMG]typeinfo.svg05-Apr-2004 14:48 1.1K 
      [   ]typeinfo.svg.xsd05-Apr-2004 14:48 1.9K 
      [   ]typeinfo.xhtml05-Apr-2004 14:48 830  
      [   ]typeinfo.xml05-Apr-2004 14:48 812  
      [   ]typeinfo.xsd05-Apr-2004 14:48 3.2K 
      [   ]xhtml-lat1.ent05-Apr-2004 14:48 11K 
      [   ]xhtml-special.ent05-Apr-2004 14:48 4.0K 
      [   ]xhtml-symbol.ent05-Apr-2004 14:48 14K 
      [TXT]xhtml1-frameset.dtd07-Apr-2004 18:09 32K 
      [TXT]xhtml1-strict.dtd05-Apr-2004 14:48 1.8K 
      [TXT]xhtml1-transitional.dtd07-Apr-2004 18:09 31K 
      [   ]Yes05-Apr-2004 14:48 1.0K 

      jsdom-19.0.0/test/to-port-to-wpts/level3/core/files/orig/index.html.1000066400000000000000000000450011415223704400252350ustar00rootroot00000000000000 Index of /2004/04/ecmascript/level3/core/files

      Index of /2004/04/ecmascript/level3/core/files

      [ICO]NameLast modifiedSizeDescription

      [DIR]Parent Directory  -  
      [IMG]barfoo.svg05-Apr-2004 14:48 794  
      [   ]barfoo.xhtml05-Apr-2004 14:48 609  
      [   ]barfoo.xml05-Apr-2004 14:48 584  
      [IMG]barfoo_base.svg05-Apr-2004 14:48 1.2K 
      [   ]barfoo_base.xhtml05-Apr-2004 14:48 807  
      [   ]barfoo_base.xml05-Apr-2004 14:48 778  
      [IMG]barfoo_nodefaultns.svg05-Apr-2004 14:48 1.0K 
      [   ]barfoo_nodefaultns.xhtml05-Apr-2004 14:48 793  
      [   ]barfoo_nodefaultns.xml05-Apr-2004 14:48 767  
      [IMG]barfoo_standalone_no.svg05-Apr-2004 14:48 850  
      [   ]barfoo_standalone_no.xhtml05-Apr-2004 14:48 665  
      [   ]barfoo_standalone_no.xml05-Apr-2004 14:48 639  
      [IMG]barfoo_standalone_yes.svg05-Apr-2004 14:48 634  
      [   ]barfoo_standalone_yes.xhtml05-Apr-2004 14:48 668  
      [   ]barfoo_standalone_yes.xml05-Apr-2004 14:48 642  
      [IMG]barfoo_utf8.svg05-Apr-2004 14:48 944  
      [   ]barfoo_utf8.xhtml05-Apr-2004 14:48 745  
      [   ]barfoo_utf8.xml05-Apr-2004 14:48 717  
      [IMG]barfoo_utf16.svg05-Apr-2004 14:48 1.8K 
      [   ]barfoo_utf16.xhtml05-Apr-2004 14:48 1.1K 
      [   ]barfoo_utf16.xml05-Apr-2004 14:48 1.2K 
      [IMG]canonicalform01.svg05-Apr-2004 14:48 536  
      [   ]canonicalform01.xhtml05-Apr-2004 14:48 382  
      [   ]canonicalform01.xml05-Apr-2004 14:48 368  
      [IMG]canonicalform02.svg05-Apr-2004 14:48 490  
      [   ]canonicalform02.xhtml05-Apr-2004 14:48 295  
      [   ]canonicalform02.xml05-Apr-2004 14:48 284  
      [IMG]canonicalform03.svg05-Apr-2004 14:48 916  
      [   ]canonicalform03.xhtml05-Apr-2004 14:48 737  
      [   ]canonicalform03.xml05-Apr-2004 14:48 719  
      [IMG]canonicalform04.svg05-Apr-2004 14:48 784  
      [   ]canonicalform04.xhtml05-Apr-2004 14:48 634  
      [   ]canonicalform04.xml05-Apr-2004 14:48 621  
      [IMG]canonicalform05.svg05-Apr-2004 14:48 611  
      [   ]canonicalform05.xhtml05-Apr-2004 14:48 462  
      [   ]canonicalform05.xml05-Apr-2004 14:48 449  
      [IMG]datatype_normalization.svg05-Apr-2004 14:48 2.9K 
      [   ]datatype_normalization.svg.xsd05-Apr-2004 14:48 2.0K 
      [   ]datatype_normalization.xml05-Apr-2004 14:48 2.8K 
      [   ]datatype_normalization.xsd05-Apr-2004 14:48 6.8K 
      [IMG]datatype_normalization2.svg05-Apr-2004 14:48 1.3K 
      [   ]datatype_normalization2.svg.xsd05-Apr-2004 14:48 1.9K 
      [   ]datatype_normalization2.xhtml05-Apr-2004 14:48 1.0K 
      [   ]datatype_normalization2.xml05-Apr-2004 14:48 1.0K 
      [   ]datatype_normalization2.xsd05-Apr-2004 14:48 2.8K 
      [IMG]external_barfoo.svg05-Apr-2004 14:48 1.1K 
      [   ]external_barfoo.xhtml05-Apr-2004 14:48 1.0K 
      [   ]external_barfoo.xml05-Apr-2004 14:48 1.0K 
      [   ]external_foo.ent05-Apr-2004 14:48 86  
      [   ]external_foobr.ent05-Apr-2004 14:48 8  
      [   ]external_widget.ent05-Apr-2004 14:48 52  
      [TXT]hc_nodtdstaff.html05-Apr-2004 14:48 300 hc_nodtdstaff
      [IMG]hc_nodtdstaff.svg05-Apr-2004 14:48 441  
      [   ]hc_nodtdstaff.xhtml05-Apr-2004 14:48 347  
      [   ]hc_nodtdstaff.xml05-Apr-2004 14:48 337  
      [IMG]hc_staff.svg05-Apr-2004 14:48 3.2K 
      [   ]hc_staff.svg.xsd05-Apr-2004 14:48 1.9K 
      [   ]hc_staff.xhtml05-Apr-2004 14:48 3.0K 
      [   ]hc_staff.xml05-Apr-2004 14:48 2.9K 
      [   ]hc_staff.xsd05-Apr-2004 14:48 7.7K 
      [   ]svgtest.js05-Apr-2004 14:48 0  
      [   ]svgunit.js05-Apr-2004 14:48 0  
      [IMG]typeinfo.svg05-Apr-2004 14:48 1.1K 
      [   ]typeinfo.svg.xsd05-Apr-2004 14:48 1.9K 
      [   ]typeinfo.xhtml05-Apr-2004 14:48 830  
      [   ]typeinfo.xml05-Apr-2004 14:48 812  
      [   ]typeinfo.xsd05-Apr-2004 14:48 3.2K 
      [   ]xhtml-lat1.ent05-Apr-2004 14:48 11K 
      [   ]xhtml-special.ent05-Apr-2004 14:48 4.0K 
      [   ]xhtml-symbol.ent05-Apr-2004 14:48 14K 
      [TXT]xhtml1-frameset.dtd07-Apr-2004 18:09 32K 
      [TXT]xhtml1-strict.dtd05-Apr-2004 14:48 1.8K 
      [TXT]xhtml1-transitional.dtd07-Apr-2004 18:09 31K 
      [   ]Yes05-Apr-2004 14:48 1.0K 

      jsdom-19.0.0/test/to-port-to-wpts/level3/core/files/orig/index.html.2000066400000000000000000007112351415223704400252470ustar00rootroot00000000000000 Index of /2004/04/ecmascript/level3/core

      Index of /2004/04/ecmascript/level3/core

      [ICO]NameLast modifiedSizeDescription

      [DIR]Parent Directory  -  
      [DIR]files/05-Apr-2004 14:49 -  
      [TXT]alltests.html07-Apr-2004 18:09 148Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/alltests
      [TXT]attrgetschematypeinfo01.html07-Apr-2004 18:09 7.4Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/attrgetschematypeinfo01
      [TXT]attrgetschematypeinfo02.html07-Apr-2004 18:09 7.4Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/attrgetschematypeinfo02
      [TXT]attrgetschematypeinfo03.html07-Apr-2004 18:09 7.5Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/attrgetschematypeinfo03
      [TXT]attrgetschematypeinfo04.html07-Apr-2004 18:09 7.4Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/attrgetschematypeinfo04
      [TXT]attrgetschematypeinfo05.html07-Apr-2004 18:09 7.5Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/attrgetschematypeinfo05
      [TXT]attrgetschematypeinfo06.html07-Apr-2004 18:09 7.2Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/attrgetschematypeinfo06
      [TXT]attrgetschematypeinfo07.html07-Apr-2004 18:09 7.7Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/attrgetschematypeinfo07
      [TXT]attrgetschematypeinfo08.html07-Apr-2004 18:09 7.4Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/attrgetschematypeinfo08
      [TXT]attrisid01.html07-Apr-2004 18:09 5.8Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/attrisid01
      [TXT]attrisid02.html07-Apr-2004 18:09 6.6Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/attrisid02
      [TXT]attrisid03.html07-Apr-2004 18:09 6.4Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/attrisid03
      [TXT]attrisid04.html07-Apr-2004 18:09 6.1Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/attrisid04
      [TXT]attrisid05.html07-Apr-2004 18:09 7.2Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/attrisid05
      [TXT]attrisid06.html07-Apr-2004 18:09 5.1Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/attrisid06
      [TXT]attrisid07.html07-Apr-2004 18:09 8.0Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/attrisid07
      [TXT]canonicalform01.html07-Apr-2004 18:09 10Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/canonicalform01
      [TXT]canonicalform02.html07-Apr-2004 18:09 9.3Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/canonicalform02
      [TXT]canonicalform03.html07-Apr-2004 18:09 9.1Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/canonicalform03
      [TXT]canonicalform04.html07-Apr-2004 18:09 7.5Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/canonicalform04
      [TXT]canonicalform05.html07-Apr-2004 18:09 17Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/canonicalform05
      [TXT]canonicalform06.html07-Apr-2004 18:09 12Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/canonicalform06
      [TXT]canonicalform07.html07-Apr-2004 18:09 11Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/canonicalform07
      [TXT]canonicalform08.html07-Apr-2004 18:09 17Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/canonicalform08
      [TXT]canonicalform09.html07-Apr-2004 18:09 13Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/canonicalform09
      [TXT]canonicalform10.html07-Apr-2004 18:09 8.3Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/canonicalform10
      [TXT]canonicalform11.html07-Apr-2004 18:09 8.8Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/canonicalform11
      [TXT]canonicalform12.html07-Apr-2004 18:09 7.2Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/canonicalform12
      [TXT]cdatasections01.html07-Apr-2004 18:09 8.1Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/cdatasections01
      [TXT]checkcharacternormalization01.html07-Apr-2004 18:09 8.6Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/checkcharacternormalization01
      [TXT]checkcharacternormalization02.html07-Apr-2004 18:09 12Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/checkcharacternormalization02
      [TXT]checkcharacternormalization03.html07-Apr-2004 18:09 9.4Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/checkcharacternormalization03
      [TXT]comments01.html07-Apr-2004 18:09 7.9Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/comments01
      [TXT]datatypenormalization01.html07-Apr-2004 18:09 13Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/datatypenormalization01
      [TXT]datatypenormalization02.html07-Apr-2004 18:09 12Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/datatypenormalization02
      [TXT]datatypenormalization03.html07-Apr-2004 18:09 12Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/datatypenormalization03
      [TXT]datatypenormalization04.html07-Apr-2004 18:09 13Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/datatypenormalization04
      [TXT]datatypenormalization05.html07-Apr-2004 18:09 13Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/datatypenormalization05
      [TXT]datatypenormalization06.html07-Apr-2004 18:09 13Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/datatypenormalization06
      [TXT]datatypenormalization07.html07-Apr-2004 18:09 9.7Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/datatypenormalization07
      [TXT]datatypenormalization08.html07-Apr-2004 18:09 9.7Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/datatypenormalization08
      [TXT]datatypenormalization09.html07-Apr-2004 18:09 9.7Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/datatypenormalization09
      [TXT]datatypenormalization10.html07-Apr-2004 18:09 9.7Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/datatypenormalization10
      [TXT]datatypenormalization11.html07-Apr-2004 18:09 9.9Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/datatypenormalization11
      [TXT]datatypenormalization12.html07-Apr-2004 18:09 9.8Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/datatypenormalization12
      [TXT]datatypenormalization13.html07-Apr-2004 18:09 10Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/datatypenormalization13
      [TXT]datatypenormalization14.html07-Apr-2004 18:09 10Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/datatypenormalization14
      [TXT]datatypenormalization15.html07-Apr-2004 18:09 12Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/datatypenormalization15
      [TXT]datatypenormalization16.html07-Apr-2004 18:09 12Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/datatypenormalization16
      [TXT]datatypenormalization17.html07-Apr-2004 18:09 11Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/datatypenormalization17
      [TXT]datatypenormalization18.html07-Apr-2004 18:09 12Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/datatypenormalization18
      [TXT]documentadoptnode01.html07-Apr-2004 18:09 12Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/documentadoptnode01
      [TXT]documentadoptnode02.html07-Apr-2004 18:09 13Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/documentadoptnode02
      [TXT]documentadoptnode03.html07-Apr-2004 18:09 8.4Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/documentadoptnode03
      [TXT]documentadoptnode04.html07-Apr-2004 18:09 9.8Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/documentadoptnode04
      [TXT]documentadoptnode05.html07-Apr-2004 18:09 9.9Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/documentadoptnode05
      [TXT]documentadoptnode06.html07-Apr-2004 18:09 13Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/documentadoptnode06
      [TXT]documentadoptnode07.html07-Apr-2004 18:09 5.4Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/documentadoptnode07
      [TXT]documentadoptnode08.html07-Apr-2004 18:09 6.8Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/documentadoptnode08
      [TXT]documentadoptnode09.html07-Apr-2004 18:09 6.8Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/documentadoptnode09
      [TXT]documentadoptnode10.html07-Apr-2004 18:09 5.7Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/documentadoptnode10
      [TXT]documentadoptnode11.html07-Apr-2004 18:09 6.7Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/documentadoptnode11
      [TXT]documentadoptnode12.html07-Apr-2004 18:09 7.2Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/documentadoptnode12
      [TXT]documentadoptnode13.html07-Apr-2004 18:09 6.8Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/documentadoptnode13
      [TXT]documentadoptnode14.html07-Apr-2004 18:09 8.7Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/documentadoptnode14
      [TXT]documentadoptnode15.html07-Apr-2004 18:09 5.8Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/documentadoptnode15
      [TXT]documentadoptnode16.html07-Apr-2004 18:09 12Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/documentadoptnode16
      [TXT]documentadoptnode17.html07-Apr-2004 18:09 6.2Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/documentadoptnode17
      [TXT]documentadoptnode18.html07-Apr-2004 18:09 7.5Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/documentadoptnode18
      [TXT]documentadoptnode19.html07-Apr-2004 18:09 6.2Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/documentadoptnode19
      [TXT]documentadoptnode20.html07-Apr-2004 18:09 7.5Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/documentadoptnode20
      [TXT]documentadoptnode21.html07-Apr-2004 18:09 8.5Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/documentadoptnode21
      [TXT]documentadoptnode22.html07-Apr-2004 18:09 6.6Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/documentadoptnode22
      [TXT]documentadoptnode23.html07-Apr-2004 18:09 7.2Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/documentadoptnode23
      [TXT]documentadoptnode24.html07-Apr-2004 18:09 8.4Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/documentadoptnode24
      [TXT]documentadoptnode25.html07-Apr-2004 18:09 7.9Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/documentadoptnode25
      [TXT]documentadoptnode26.html07-Apr-2004 18:09 8.7Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/documentadoptnode26
      [TXT]documentadoptnode27.html07-Apr-2004 18:09 9.0Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/documentadoptnode27
      [TXT]documentadoptnode28.html07-Apr-2004 18:09 6.8Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/documentadoptnode28
      [TXT]documentadoptnode30.html07-Apr-2004 18:09 6.0Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/documentadoptnode30
      [TXT]documentadoptnode31.html07-Apr-2004 18:09 7.4Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/documentadoptnode31
      [TXT]documentadoptnode32.html07-Apr-2004 18:09 6.8Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/documentadoptnode32
      [TXT]documentadoptnode33.html07-Apr-2004 18:09 7.4Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/documentadoptnode33
      [TXT]documentadoptnode34.html07-Apr-2004 18:09 7.4Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/documentadoptnode34
      [TXT]documentadoptnode35.html07-Apr-2004 18:09 7.9Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/documentadoptnode35
      [TXT]documentadoptnode36.html07-Apr-2004 18:09 9.9Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/documentadoptnode36
      [TXT]documentgetdoctype01.html07-Apr-2004 18:09 8.1Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/documentgetdoctype01
      [TXT]documentgetdocumenturi01.html07-Apr-2004 18:09 4.9Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/documentgetdocumenturi01
      [TXT]documentgetdocumenturi02.html07-Apr-2004 18:09 6.2Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/documentgetdocumenturi02
      [TXT]documentgetdocumenturi03.html07-Apr-2004 18:09 7.0Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/documentgetdocumenturi03
      [TXT]documentgetinputencoding01.html07-Apr-2004 18:09 5.1Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/documentgetinputencoding01
      [TXT]documentgetinputencoding02.html07-Apr-2004 18:09 6.3Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/documentgetinputencoding02
      [TXT]documentgetinputencoding03.html07-Apr-2004 18:09 5.2Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/documentgetinputencoding03
      [TXT]documentgetinputencoding04.html07-Apr-2004 18:09 5.9Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/documentgetinputencoding04
      [TXT]documentgetstricterrorchecking01.html07-Apr-2004 18:09 5.2Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/documentgetstricterrorchecking01
      [TXT]documentgetstricterrorchecking02.html07-Apr-2004 18:09 6.5Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/documentgetstricterrorchecking02
      [TXT]documentgetxmlencoding01.html07-Apr-2004 18:09 5.2Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/documentgetxmlencoding01
      [TXT]documentgetxmlencoding02.html07-Apr-2004 18:09 6.3Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/documentgetxmlencoding02
      [TXT]documentgetxmlencoding03.html07-Apr-2004 18:09 5.1Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/documentgetxmlencoding03
      [TXT]documentgetxmlencoding04.html07-Apr-2004 18:09 5.2Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/documentgetxmlencoding04
      [TXT]documentgetxmlencoding05.html07-Apr-2004 18:09 5.8Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/documentgetxmlencoding05
      [TXT]documentgetxmlstandalone01.html07-Apr-2004 18:09 5.2Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/documentgetxmlstandalone01
      [TXT]documentgetxmlstandalone02.html07-Apr-2004 18:09 6.3Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/documentgetxmlstandalone02
      [TXT]documentgetxmlstandalone03.html07-Apr-2004 18:09 5.1Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/documentgetxmlstandalone03
      [TXT]documentgetxmlstandalone04.html07-Apr-2004 18:09 5.2Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/documentgetxmlstandalone04
      [TXT]documentgetxmlstandalone05.html07-Apr-2004 18:09 7.2Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/documentgetxmlstandalone05
      [TXT]documentgetxmlversion01.html07-Apr-2004 18:09 5.1Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/documentgetxmlversion01
      [TXT]documentgetxmlversion02.html07-Apr-2004 18:09 6.4Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/documentgetxmlversion02
      [TXT]documentgetxmlversion03.html07-Apr-2004 18:09 5.1Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/documentgetxmlversion03
      [TXT]documentnormalizedocument01.html07-Apr-2004 18:09 7.0Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/documentnormalizedocument01
      [TXT]documentnormalizedocument02.html07-Apr-2004 18:09 9.9Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/documentnormalizedocument02
      [TXT]documentnormalizedocument03.html07-Apr-2004 18:09 10Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/documentnormalizedocument03
      [TXT]documentnormalizedocument04.html07-Apr-2004 18:09 9.7Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/documentnormalizedocument04
      [TXT]documentnormalizedocument05.html07-Apr-2004 18:09 15Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/documentnormalizedocument05
      [TXT]documentnormalizedocument06.html07-Apr-2004 18:09 21Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/documentnormalizedocument06
      [TXT]documentnormalizedocument07.html07-Apr-2004 18:09 18Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/documentnormalizedocument07
      [TXT]documentnormalizedocument08.html07-Apr-2004 18:09 11Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/documentnormalizedocument08
      [TXT]documentnormalizedocument09.html07-Apr-2004 18:09 10Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/documentnormalizedocument09
      [TXT]documentnormalizedocument10.html07-Apr-2004 18:09 10Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/documentnormalizedocument10
      [TXT]documentnormalizedocument11.html07-Apr-2004 18:09 9.2Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/documentnormalizedocument11
      [TXT]documentnormalizedocument12.html07-Apr-2004 18:09 11Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/documentnormalizedocument12
      [TXT]documentnormalizedocument13.html07-Apr-2004 18:09 15Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/documentnormalizedocument13
      [TXT]documentrenamenode01.html07-Apr-2004 18:09 7.7Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/documentrenamenode01
      [TXT]documentrenamenode02.html07-Apr-2004 18:09 7.5Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/documentrenamenode02
      [TXT]documentrenamenode03.html07-Apr-2004 18:09 6.7Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/documentrenamenode03
      [TXT]documentrenamenode04.html07-Apr-2004 18:09 6.4Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/documentrenamenode04
      [TXT]documentrenamenode05.html07-Apr-2004 18:09 6.5Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/documentrenamenode05
      [TXT]documentrenamenode06.html07-Apr-2004 18:09 7.5Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/documentrenamenode06
      [TXT]documentrenamenode07.html07-Apr-2004 18:09 8.0Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/documentrenamenode07
      [TXT]documentrenamenode08.html07-Apr-2004 18:09 7.7Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/documentrenamenode08
      [TXT]documentrenamenode09.html07-Apr-2004 18:09 7.8Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/documentrenamenode09
      [TXT]documentrenamenode10.html07-Apr-2004 18:09 8.3Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/documentrenamenode10
      [TXT]documentrenamenode11.html07-Apr-2004 18:09 7.0Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/documentrenamenode11
      [TXT]documentrenamenode12.html07-Apr-2004 18:09 7.0Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/documentrenamenode12
      [TXT]documentrenamenode13.html07-Apr-2004 18:09 7.0Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/documentrenamenode13
      [TXT]documentrenamenode14.html07-Apr-2004 18:09 7.1Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/documentrenamenode14
      [TXT]documentrenamenode15.html07-Apr-2004 18:09 7.0Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/documentrenamenode15
      [TXT]documentrenamenode16.html07-Apr-2004 18:09 7.2Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/documentrenamenode16
      [TXT]documentrenamenode17.html07-Apr-2004 18:09 8.4Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/documentrenamenode17
      [TXT]documentrenamenode18.html07-Apr-2004 18:09 7.2Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/documentrenamenode18
      [TXT]documentrenamenode19.html07-Apr-2004 18:09 8.3Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/documentrenamenode19
      [TXT]documentrenamenode20.html07-Apr-2004 18:09 7.0Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/documentrenamenode20
      [TXT]documentrenamenode21.html07-Apr-2004 18:09 7.3Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/documentrenamenode21
      [TXT]documentrenamenode22.html07-Apr-2004 18:09 6.0Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/documentrenamenode22
      [TXT]documentrenamenode23.html07-Apr-2004 18:09 6.1Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/documentrenamenode23
      [TXT]documentrenamenode24.html07-Apr-2004 18:09 6.4Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/documentrenamenode24
      [TXT]documentrenamenode25.html07-Apr-2004 18:09 5.8Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/documentrenamenode25
      [TXT]documentrenamenode26.html07-Apr-2004 18:09 5.8Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/documentrenamenode26
      [TXT]documentrenamenode27.html07-Apr-2004 18:09 12Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/documentrenamenode27
      [TXT]documentrenamenode28.html07-Apr-2004 18:09 7.9Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/documentrenamenode28
      [TXT]documentrenamenode29.html07-Apr-2004 18:09 5.9Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/documentrenamenode29
      [TXT]documentsetdocumenturi01.html07-Apr-2004 18:09 5.3Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/documentsetdocumenturi01
      [TXT]documentsetdocumenturi02.html07-Apr-2004 18:09 5.4Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/documentsetdocumenturi02
      [TXT]documentsetdocumenturi03.html07-Apr-2004 18:09 6.6Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/documentsetdocumenturi03
      [TXT]documentsetstricterrorchecking01.html07-Apr-2004 18:09 6.2Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/documentsetstricterrorchecking01
      [TXT]documentsetstricterrorchecking02.html07-Apr-2004 18:09 6.1Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/documentsetstricterrorchecking02
      [TXT]documentsetstricterrorchecking03.html07-Apr-2004 18:09 5.4Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/documentsetstricterrorchecking03
      [TXT]documentsetxmlstandalone01.html07-Apr-2004 18:09 5.1Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/documentsetxmlstandalone01
      [TXT]documentsetxmlstandalone02.html07-Apr-2004 18:09 6.9Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/documentsetxmlstandalone02
      [TXT]documentsetxmlversion01.html07-Apr-2004 18:09 9.2Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/documentsetxmlversion01
      [TXT]documentsetxmlversion02.html07-Apr-2004 18:09 6.5Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/documentsetxmlversion02
      [TXT]documentsetxmlversion03.html07-Apr-2004 18:09 6.5Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/documentsetxmlversion03
      [TXT]documentsetxmlversion05.html07-Apr-2004 18:09 6.6Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/documentsetxmlversion05
      [TXT]domconfigcanonicalform1.html07-Apr-2004 18:09 9.2Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/domconfigcanonicalform1
      [TXT]domconfigcdatasections1.html07-Apr-2004 18:09 7.6Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/domconfigcdatasections1
      [TXT]domconfigcheckcharacternormalization1.html07-Apr-2004 18:09 9.4Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/domconfigcheckcharacternormalization1
      [TXT]domconfigcomments1.html07-Apr-2004 18:09 7.1Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/domconfigcomments1
      [TXT]domconfigdatatypenormalization1.html07-Apr-2004 18:09 8.9Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/domconfigdatatypenormalization1
      [TXT]domconfigdatatypenormalization2.html07-Apr-2004 18:09 6.6Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/domconfigdatatypenormalization2
      [TXT]domconfigelementcontentwhitespace1.html07-Apr-2004 18:09 9.4Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/domconfigelementcontentwhitespace1
      [TXT]domconfigentities1.html07-Apr-2004 18:09 7.5Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/domconfigentities1
      [TXT]domconfigerrorhandler1.html07-Apr-2004 18:09 10Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/domconfigerrorhandler1
      [TXT]domconfigerrorhandler2.html07-Apr-2004 18:09 6.8Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/domconfigerrorhandler2
      [TXT]domconfiginfoset1.html07-Apr-2004 18:09 9.5Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/domconfiginfoset1
      [TXT]domconfignamespacedeclarations1.html07-Apr-2004 18:09 7.7Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/domconfignamespacedeclarations1
      [TXT]domconfignamespaces1.html07-Apr-2004 18:09 8.8Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/domconfignamespaces1
      [TXT]domconfignamespaces2.html07-Apr-2004 18:09 5.4Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/domconfignamespaces2
      [TXT]domconfignormalizecharacters1.html07-Apr-2004 18:09 9.3Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/domconfignormalizecharacters1
      [TXT]domconfigparameternames01.html07-Apr-2004 18:09 18Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/domconfigparameternames01
      [TXT]domconfigschemalocation1.html07-Apr-2004 18:09 9.5Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/domconfigschemalocation1
      [TXT]domconfigschematype1.html07-Apr-2004 18:09 12Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/domconfigschematype1
      [TXT]domconfigsplitcdatasections1.html07-Apr-2004 18:09 7.7Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/domconfigsplitcdatasections1
      [TXT]domconfigurationcansetparameter01.html07-Apr-2004 18:09 7.3Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/domconfigurationcansetparameter01
      [TXT]domconfigurationcansetparameter02.html07-Apr-2004 18:09 8.2Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/domconfigurationcansetparameter02
      [TXT]domconfigurationcansetparameter03.html07-Apr-2004 18:09 7.3Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/domconfigurationcansetparameter03
      [TXT]domconfigurationcansetparameter04.html07-Apr-2004 18:09 7.5Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/domconfigurationcansetparameter04
      [TXT]domconfigurationcansetparameter06.html07-Apr-2004 18:09 8.7Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/domconfigurationcansetparameter06
      [TXT]domconfigurationgetparameter01.html07-Apr-2004 18:09 6.9Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/domconfigurationgetparameter01
      [TXT]domconfigurationgetparameter02.html07-Apr-2004 18:09 6.0Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/domconfigurationgetparameter02
      [TXT]domconfigvalidate1.html07-Apr-2004 18:09 9.2Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/domconfigvalidate1
      [TXT]domconfigvalidateifschema1.html07-Apr-2004 18:09 9.3Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/domconfigvalidateifschema1
      [TXT]domconfigwellformed1.html07-Apr-2004 18:09 9.0Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/domconfigwellformed1
      [TXT]domimplementationgetfeature01.html07-Apr-2004 18:09 5.6Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/domimplementationgetfeature01
      [TXT]domimplementationgetfeature02.html07-Apr-2004 18:09 5.6Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/domimplementationgetfeature02
      [TXT]domimplementationgetfeature03.html07-Apr-2004 18:09 5.8Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/domimplementationgetfeature03
      [TXT]domimplementationgetfeature05.html07-Apr-2004 18:09 5.6Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/domimplementationgetfeature05
      [TXT]domimplementationgetfeature06.html07-Apr-2004 18:09 5.5Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/domimplementationgetfeature06
      [TXT]domimplementationregistry01.html07-Apr-2004 18:09 4.7Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/domimplementationregistry01
      [TXT]domimplementationregistry02.html07-Apr-2004 18:09 6.1Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/domimplementationregistry02
      [TXT]domimplementationregistry03.html07-Apr-2004 18:09 6.0Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/domimplementationregistry03
      [TXT]domimplementationregistry04.html07-Apr-2004 18:09 6.1Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/domimplementationregistry04
      [TXT]domimplementationregistry05.html07-Apr-2004 18:09 6.0Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/domimplementationregistry05
      [TXT]domimplementationregistry06.html07-Apr-2004 18:09 6.7Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/domimplementationregistry06
      [TXT]domimplementationregistry07.html07-Apr-2004 18:09 5.8Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/domimplementationregistry07
      [TXT]domimplementationregistry08.html07-Apr-2004 18:09 7.0Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/domimplementationregistry08
      [TXT]domimplementationregistry09.html07-Apr-2004 18:09 7.1Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/domimplementationregistry09
      [TXT]domimplementationregistry10.html07-Apr-2004 18:09 7.1Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/domimplementationregistry10
      [TXT]domimplementationregistry11.html07-Apr-2004 18:09 7.1Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/domimplementationregistry11
      [TXT]domimplementationregistry12.html07-Apr-2004 18:09 10Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/domimplementationregistry12
      [TXT]domimplementationregistry13.html07-Apr-2004 18:09 8.1Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/domimplementationregistry13
      [TXT]domimplementationregistry14.html07-Apr-2004 18:09 6.8Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/domimplementationregistry14
      [TXT]domimplementationregistry15.html07-Apr-2004 18:09 7.0Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/domimplementationregistry15
      [TXT]domimplementationregistry16.html07-Apr-2004 18:09 6.8Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/domimplementationregistry16
      [TXT]domimplementationregistry17.html07-Apr-2004 18:09 7.6Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/domimplementationregistry17
      [TXT]domimplementationregistry18.html07-Apr-2004 18:09 6.0Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/domimplementationregistry18
      [TXT]domimplementationregistry19.html07-Apr-2004 18:09 7.9Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/domimplementationregistry19
      [TXT]domimplementationregistry20.html07-Apr-2004 18:09 8.0Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/domimplementationregistry20
      [TXT]domimplementationregistry21.html07-Apr-2004 18:09 7.9Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/domimplementationregistry21
      [TXT]domimplementationregistry22.html07-Apr-2004 18:09 8.0Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/domimplementationregistry22
      [TXT]domimplementationregistry23.html07-Apr-2004 18:09 11Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/domimplementationregistry23
      [TXT]domimplementationregistry24.html07-Apr-2004 18:09 5.8Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/domimplementationregistry24
      [TXT]domimplementationregistry25.html07-Apr-2004 18:09 6.4Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/domimplementationregistry25
      [TXT]domstringlistcontains01.html07-Apr-2004 18:09 6.1Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/domstringlistcontains01
      [TXT]domstringlistcontains02.html07-Apr-2004 18:09 8.7Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/domstringlistcontains02
      [TXT]domstringlistgetlength01.html07-Apr-2004 18:09 6.5Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/domstringlistgetlength01
      [TXT]domstringlistitem01.html07-Apr-2004 18:09 6.9Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/domstringlistitem01
      [TXT]domstringlistitem02.html07-Apr-2004 18:09 6.4Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/domstringlistitem02
      [   ]DOMTestCase.js07-Apr-2004 18:09 35K 
      [   ]DOMTestSuite.js05-Apr-2004 14:48 5.3K 
      [TXT]elementcontentwhitespace01.html07-Apr-2004 18:09 9.9Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/elementcontentwhitespace01
      [TXT]elementcontentwhitespace02.html07-Apr-2004 18:09 9.7Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/elementcontentwhitespace02
      [TXT]elementcontentwhitespace03.html07-Apr-2004 18:09 11Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/elementcontentwhitespace03
      [TXT]elementgetschematypeinfo01.html07-Apr-2004 18:09 6.9Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/elementgetschematypeinfo01
      [TXT]elementgetschematypeinfo02.html07-Apr-2004 18:09 7.1Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/elementgetschematypeinfo02
      [TXT]elementgetschematypeinfo03.html07-Apr-2004 18:09 6.9Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/elementgetschematypeinfo03
      [TXT]elementgetschematypeinfo04.html07-Apr-2004 18:09 7.3Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/elementgetschematypeinfo04
      [TXT]elementgetschematypeinfo05.html07-Apr-2004 18:09 7.1Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/elementgetschematypeinfo05
      [TXT]elementgetschematypeinfo06.html07-Apr-2004 18:09 7.3Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/elementgetschematypeinfo06
      [TXT]elementgetschematypeinfo07.html07-Apr-2004 18:09 7.3Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/elementgetschematypeinfo07
      [TXT]elementsetidattribute01.html07-Apr-2004 18:09 7.5Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/elementsetidattribute01
      [TXT]elementsetidattribute03.html07-Apr-2004 18:09 7.7Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/elementsetidattribute03
      [TXT]elementsetidattribute04.html07-Apr-2004 18:09 7.7Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/elementsetidattribute04
      [TXT]elementsetidattribute05.html07-Apr-2004 18:09 5.8Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/elementsetidattribute05
      [TXT]elementsetidattribute06.html07-Apr-2004 18:09 5.8Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/elementsetidattribute06
      [TXT]elementsetidattribute07.html07-Apr-2004 18:09 9.0Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/elementsetidattribute07
      [TXT]elementsetidattribute08.html07-Apr-2004 18:09 8.9Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/elementsetidattribute08
      [TXT]elementsetidattribute09.html07-Apr-2004 18:09 9.2Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/elementsetidattribute09
      [TXT]elementsetidattribute10.html07-Apr-2004 18:09 7.6Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/elementsetidattribute10
      [TXT]elementsetidattribute11.html07-Apr-2004 18:09 7.7Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/elementsetidattribute11
      [TXT]elementsetidattributenode01.html07-Apr-2004 18:09 7.7Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/elementsetidattributenode01
      [TXT]elementsetidattributenode02.html07-Apr-2004 18:09 7.7Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/elementsetidattributenode02
      [TXT]elementsetidattributenode03.html07-Apr-2004 18:09 8.0Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/elementsetidattributenode03
      [TXT]elementsetidattributenode04.html07-Apr-2004 18:09 8.2Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/elementsetidattributenode04
      [TXT]elementsetidattributenode05.html07-Apr-2004 18:09 7.0Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/elementsetidattributenode05
      [TXT]elementsetidattributenode06.html07-Apr-2004 18:09 7.1Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/elementsetidattributenode06
      [TXT]elementsetidattributenode07.html07-Apr-2004 18:09 8.9Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/elementsetidattributenode07
      [TXT]elementsetidattributenode08.html07-Apr-2004 18:09 9.8Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/elementsetidattributenode08
      [TXT]elementsetidattributenode09.html07-Apr-2004 18:09 8.4Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/elementsetidattributenode09
      [TXT]elementsetidattributenode10.html07-Apr-2004 18:09 8.5Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/elementsetidattributenode10
      [TXT]elementsetidattributens01.html07-Apr-2004 18:09 8.0Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/elementsetidattributens01
      [TXT]elementsetidattributens02.html07-Apr-2004 18:09 8.5Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/elementsetidattributens02
      [TXT]elementsetidattributens03.html07-Apr-2004 18:09 8.1Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/elementsetidattributens03
      [TXT]elementsetidattributens04.html07-Apr-2004 18:09 8.9Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/elementsetidattributens04
      [TXT]elementsetidattributens05.html07-Apr-2004 18:09 8.7Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/elementsetidattributens05
      [TXT]elementsetidattributens06.html07-Apr-2004 18:09 6.0Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/elementsetidattributens06
      [TXT]elementsetidattributens07.html07-Apr-2004 18:09 5.9Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/elementsetidattributens07
      [TXT]elementsetidattributens08.html07-Apr-2004 18:09 5.9Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/elementsetidattributens08
      [TXT]elementsetidattributens09.html07-Apr-2004 18:09 7.5Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/elementsetidattributens09
      [TXT]elementsetidattributens10.html07-Apr-2004 18:09 9.5Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/elementsetidattributens10
      [TXT]elementsetidattributens11.html07-Apr-2004 18:09 9.6Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/elementsetidattributens11
      [TXT]elementsetidattributens12.html07-Apr-2004 18:09 11Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/elementsetidattributens12
      [TXT]elementsetidattributens13.html07-Apr-2004 18:09 8.4Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/elementsetidattributens13
      [TXT]elementsetidattributens14.html07-Apr-2004 18:09 9.9Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/elementsetidattributens14
      [TXT]entities01.html07-Apr-2004 18:09 9.3Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/entities01
      [TXT]entities02.html07-Apr-2004 18:09 9.8Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/entities02
      [TXT]entities03.html07-Apr-2004 18:09 8.8Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/entities03
      [TXT]entities04.html07-Apr-2004 18:09 9.2Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/entities04
      [TXT]entitygetinputencoding01.html07-Apr-2004 18:09 5.8Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/entitygetinputencoding01
      [TXT]entitygetinputencoding02.html07-Apr-2004 18:09 5.8Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/entitygetinputencoding02
      [TXT]entitygetinputencoding03.html07-Apr-2004 18:09 7.3Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/entitygetinputencoding03
      [TXT]entitygetinputencoding04.html07-Apr-2004 18:09 6.8Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/entitygetinputencoding04
      [TXT]entitygetxmlencoding01.html07-Apr-2004 18:09 5.8Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/entitygetxmlencoding01
      [TXT]entitygetxmlencoding02.html07-Apr-2004 18:09 5.7Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/entitygetxmlencoding02
      [TXT]entitygetxmlencoding03.html07-Apr-2004 18:09 6.3Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/entitygetxmlencoding03
      [TXT]entitygetxmlencoding04.html07-Apr-2004 18:09 6.2Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/entitygetxmlencoding04
      [TXT]entitygetxmlversion01.html07-Apr-2004 18:09 5.7Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/entitygetxmlversion01
      [TXT]entitygetxmlversion02.html07-Apr-2004 18:09 5.8Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/entitygetxmlversion02
      [TXT]entitygetxmlversion03.html07-Apr-2004 18:09 6.3Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/entitygetxmlversion03
      [TXT]entitygetxmlversion04.html07-Apr-2004 18:09 6.3Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/entitygetxmlversion04
      [TXT]handleerror01.html07-Apr-2004 18:09 13Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/handleerror01
      [TXT]handleerror02.html07-Apr-2004 18:09 10Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/handleerror02
      [TXT]hasFeature01.html07-Apr-2004 18:09 4.4Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/hasFeature01
      [TXT]hasFeature02.html07-Apr-2004 18:09 4.3Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/hasFeature02
      [TXT]hasFeature03.html07-Apr-2004 18:09 4.3Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/hasFeature03
      [TXT]hasFeature04.html07-Apr-2004 18:09 4.4Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/hasFeature04
      [TXT]infoset01.html07-Apr-2004 18:09 9.8Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/infoset01
      [TXT]infoset02.html07-Apr-2004 18:09 8.8Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/infoset02
      [TXT]infoset03.html07-Apr-2004 18:09 11Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/infoset03
      [TXT]infoset04.html07-Apr-2004 18:09 8.6Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/infoset04
      [TXT]infoset05.html07-Apr-2004 18:09 6.7Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/infoset05
      [TXT]infoset06.html07-Apr-2004 18:09 11Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/infoset06
      [TXT]infoset07.html07-Apr-2004 18:09 11Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/infoset07
      [TXT]infoset08.html07-Apr-2004 18:09 9.6Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/infoset08
      [TXT]infoset09.html07-Apr-2004 18:09 8.2Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/infoset09
      [TXT]namespacedeclarations01.html07-Apr-2004 18:09 6.9Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/namespacedeclarations01
      [TXT]namespacedeclarations02.html07-Apr-2004 18:09 6.9Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/namespacedeclarations02
      [TXT]nodeappendchild01.html07-Apr-2004 18:09 6.9Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodeappendchild01
      [TXT]nodeappendchild02.html07-Apr-2004 18:09 6.7Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodeappendchild02
      [TXT]nodecomparedocumentposition01.html07-Apr-2004 18:09 6.2Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodecomparedocumentposition01
      [TXT]nodecomparedocumentposition02.html07-Apr-2004 18:09 7.5Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodecomparedocumentposition02
      [TXT]nodecomparedocumentposition03.html07-Apr-2004 18:09 7.9Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodecomparedocumentposition03
      [TXT]nodecomparedocumentposition04.html07-Apr-2004 18:09 5.3Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodecomparedocumentposition04
      [TXT]nodecomparedocumentposition05.html07-Apr-2004 18:09 8.2Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodecomparedocumentposition05
      [TXT]nodecomparedocumentposition06.html07-Apr-2004 18:09 6.3Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodecomparedocumentposition06
      [TXT]nodecomparedocumentposition07.html07-Apr-2004 18:09 6.8Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodecomparedocumentposition07
      [TXT]nodecomparedocumentposition08.html07-Apr-2004 18:09 6.4Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodecomparedocumentposition08
      [TXT]nodecomparedocumentposition09.html07-Apr-2004 18:09 7.1Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodecomparedocumentposition09
      [TXT]nodecomparedocumentposition10.html07-Apr-2004 18:09 5.9Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodecomparedocumentposition10
      [TXT]nodecomparedocumentposition11.html07-Apr-2004 18:09 6.4Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodecomparedocumentposition11
      [TXT]nodecomparedocumentposition12.html07-Apr-2004 18:09 6.5Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodecomparedocumentposition12
      [TXT]nodecomparedocumentposition13.html07-Apr-2004 18:09 6.9Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodecomparedocumentposition13
      [TXT]nodecomparedocumentposition14.html07-Apr-2004 18:09 7.0Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodecomparedocumentposition14
      [TXT]nodecomparedocumentposition15.html07-Apr-2004 18:09 7.5Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodecomparedocumentposition15
      [TXT]nodecomparedocumentposition16.html07-Apr-2004 18:09 8.0Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodecomparedocumentposition16
      [TXT]nodecomparedocumentposition17.html07-Apr-2004 18:09 6.8Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodecomparedocumentposition17
      [TXT]nodecomparedocumentposition18.html07-Apr-2004 18:09 6.9Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodecomparedocumentposition18
      [TXT]nodecomparedocumentposition19.html07-Apr-2004 18:09 7.9Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodecomparedocumentposition19
      [TXT]nodecomparedocumentposition20.html07-Apr-2004 18:09 7.0Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodecomparedocumentposition20
      [TXT]nodecomparedocumentposition21.html07-Apr-2004 18:09 7.4Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodecomparedocumentposition21
      [TXT]nodecomparedocumentposition22.html07-Apr-2004 18:09 7.1Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodecomparedocumentposition22
      [TXT]nodecomparedocumentposition23.html07-Apr-2004 18:09 7.8Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodecomparedocumentposition23
      [TXT]nodecomparedocumentposition24.html07-Apr-2004 18:09 6.2Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodecomparedocumentposition24
      [TXT]nodecomparedocumentposition25.html07-Apr-2004 18:09 6.8Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodecomparedocumentposition25
      [TXT]nodecomparedocumentposition26.html07-Apr-2004 18:09 8.3Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodecomparedocumentposition26
      [TXT]nodecomparedocumentposition27.html07-Apr-2004 18:09 8.3Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodecomparedocumentposition27
      [TXT]nodecomparedocumentposition28.html07-Apr-2004 18:09 8.9Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodecomparedocumentposition28
      [TXT]nodecomparedocumentposition29.html07-Apr-2004 18:09 8.2Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodecomparedocumentposition29
      [TXT]nodecomparedocumentposition30.html07-Apr-2004 18:09 6.3Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodecomparedocumentposition30
      [TXT]nodecomparedocumentposition31.html07-Apr-2004 18:09 7.5Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodecomparedocumentposition31
      [TXT]nodecomparedocumentposition32.html07-Apr-2004 18:09 6.6Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodecomparedocumentposition32
      [TXT]nodecomparedocumentposition33.html07-Apr-2004 18:09 9.4Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodecomparedocumentposition33
      [TXT]nodecomparedocumentposition34.html07-Apr-2004 18:09 7.7Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodecomparedocumentposition34
      [TXT]nodecomparedocumentposition35.html07-Apr-2004 18:09 6.6Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodecomparedocumentposition35
      [TXT]nodecomparedocumentposition36.html07-Apr-2004 18:09 7.2Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodecomparedocumentposition36
      [TXT]nodecomparedocumentposition37.html07-Apr-2004 18:09 6.8Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodecomparedocumentposition37
      [TXT]nodecomparedocumentposition38.html07-Apr-2004 18:09 6.8Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodecomparedocumentposition38
      [TXT]nodecomparedocumentposition39.html07-Apr-2004 18:09 7.5Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodecomparedocumentposition39
      [TXT]nodecomparedocumentposition40.html07-Apr-2004 18:09 7.7Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodecomparedocumentposition40
      [TXT]nodegetbaseuri01.html07-Apr-2004 18:09 6.0Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodegetbaseuri01
      [TXT]nodegetbaseuri02.html07-Apr-2004 18:09 7.5Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodegetbaseuri02
      [TXT]nodegetbaseuri03.html07-Apr-2004 18:09 5.7Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodegetbaseuri03
      [TXT]nodegetbaseuri04.html07-Apr-2004 18:09 6.2Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodegetbaseuri04
      [TXT]nodegetbaseuri05.html07-Apr-2004 18:09 5.8Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodegetbaseuri05
      [TXT]nodegetbaseuri06.html07-Apr-2004 18:09 6.1Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodegetbaseuri06
      [TXT]nodegetbaseuri07.html07-Apr-2004 18:09 7.0Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodegetbaseuri07
      [TXT]nodegetbaseuri09.html07-Apr-2004 18:09 6.1Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodegetbaseuri09
      [TXT]nodegetbaseuri10.html07-Apr-2004 18:09 6.6Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodegetbaseuri10
      [TXT]nodegetbaseuri11.html07-Apr-2004 18:09 7.8Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodegetbaseuri11
      [TXT]nodegetbaseuri12.html07-Apr-2004 18:09 6.3Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodegetbaseuri12
      [TXT]nodegetbaseuri13.html07-Apr-2004 18:09 6.7Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodegetbaseuri13
      [TXT]nodegetbaseuri14.html07-Apr-2004 18:09 7.8Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodegetbaseuri14
      [TXT]nodegetbaseuri15.html07-Apr-2004 18:09 6.1Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodegetbaseuri15
      [TXT]nodegetbaseuri16.html07-Apr-2004 18:09 6.6Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodegetbaseuri16
      [TXT]nodegetbaseuri17.html07-Apr-2004 18:09 6.1Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodegetbaseuri17
      [TXT]nodegetbaseuri18.html07-Apr-2004 18:09 6.1Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodegetbaseuri18
      [TXT]nodegetbaseuri19.html07-Apr-2004 18:09 8.5Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodegetbaseuri19
      [TXT]nodegetbaseuri20.html07-Apr-2004 18:09 6.5Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodegetbaseuri20
      [TXT]nodegetfeature01.html07-Apr-2004 18:09 15Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodegetfeature01
      [TXT]nodegetfeature02.html07-Apr-2004 18:09 15Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodegetfeature02
      [TXT]nodegetfeature03.html07-Apr-2004 18:09 15Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodegetfeature03
      [TXT]nodegetfeature04.html07-Apr-2004 18:09 15Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodegetfeature04
      [TXT]nodegetfeature05.html07-Apr-2004 18:09 15Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodegetfeature05
      [TXT]nodegetfeature06.html07-Apr-2004 18:09 15Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodegetfeature06
      [TXT]nodegetfeature07.html07-Apr-2004 18:09 15Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodegetfeature07
      [TXT]nodegetfeature08.html07-Apr-2004 18:09 15Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodegetfeature08
      [TXT]nodegetfeature09.html07-Apr-2004 18:09 15Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodegetfeature09
      [TXT]nodegetfeature10.html07-Apr-2004 18:09 15Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodegetfeature10
      [TXT]nodegetfeature11.html07-Apr-2004 18:09 15Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodegetfeature11
      [TXT]nodegetfeature12.html07-Apr-2004 18:09 15Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodegetfeature12
      [TXT]nodegetfeature13.html07-Apr-2004 18:09 15Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodegetfeature13
      [TXT]nodegettextcontent01.html07-Apr-2004 18:09 4.9Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodegettextcontent01
      [TXT]nodegettextcontent02.html07-Apr-2004 18:09 6.2Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodegettextcontent02
      [TXT]nodegettextcontent03.html07-Apr-2004 18:09 5.2Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodegettextcontent03
      [TXT]nodegettextcontent04.html07-Apr-2004 18:09 6.1Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodegettextcontent04
      [TXT]nodegettextcontent05.html07-Apr-2004 18:09 5.6Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodegettextcontent05
      [TXT]nodegettextcontent06.html07-Apr-2004 18:09 5.7Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodegettextcontent06
      [TXT]nodegettextcontent07.html07-Apr-2004 18:09 6.1Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodegettextcontent07
      [TXT]nodegettextcontent08.html07-Apr-2004 18:09 6.3Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodegettextcontent08
      [TXT]nodegettextcontent09.html07-Apr-2004 18:09 5.9Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodegettextcontent09
      [TXT]nodegettextcontent10.html07-Apr-2004 18:09 5.7Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodegettextcontent10
      [TXT]nodegettextcontent11.html07-Apr-2004 18:09 5.9Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodegettextcontent11
      [TXT]nodegettextcontent12.html07-Apr-2004 18:09 5.9Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodegettextcontent12
      [TXT]nodegettextcontent13.html07-Apr-2004 18:09 5.9Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodegettextcontent13
      [TXT]nodegettextcontent14.html07-Apr-2004 18:09 5.9Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodegettextcontent14
      [TXT]nodegettextcontent15.html07-Apr-2004 18:09 8.2Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodegettextcontent15
      [TXT]nodegettextcontent16.html07-Apr-2004 18:09 8.7Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodegettextcontent16
      [TXT]nodegettextcontent17.html07-Apr-2004 18:09 5.8Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodegettextcontent17
      [TXT]nodegettextcontent18.html07-Apr-2004 18:09 5.7Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodegettextcontent18
      [TXT]nodegettextcontent19.html07-Apr-2004 18:09 6.0Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodegettextcontent19
      [TXT]nodegetuserdata01.html07-Apr-2004 18:09 5.0Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodegetuserdata01
      [TXT]nodegetuserdata02.html07-Apr-2004 18:09 5.0Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodegetuserdata02
      [TXT]nodegetuserdata03.html07-Apr-2004 18:09 6.3Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodegetuserdata03
      [TXT]nodegetuserdata04.html07-Apr-2004 18:09 6.2Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodegetuserdata04
      [TXT]nodegetuserdata05.html07-Apr-2004 18:09 6.7Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodegetuserdata05
      [TXT]nodegetuserdata06.html07-Apr-2004 18:09 5.2Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodegetuserdata06
      [TXT]nodegetuserdata07.html07-Apr-2004 18:09 6.2Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodegetuserdata07
      [TXT]nodeinsertbefore01.html07-Apr-2004 18:09 7.2Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodeinsertbefore01
      [TXT]nodeinsertbefore02.html07-Apr-2004 18:09 8.7Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodeinsertbefore02
      [TXT]nodeinsertbefore03.html07-Apr-2004 18:09 6.0Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodeinsertbefore03
      [TXT]nodeinsertbefore04.html07-Apr-2004 18:09 5.7Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodeinsertbefore04
      [TXT]nodeinsertbefore05.html07-Apr-2004 18:09 7.2Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodeinsertbefore05
      [TXT]nodeinsertbefore06.html07-Apr-2004 18:09 7.2Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodeinsertbefore06
      [TXT]nodeinsertbefore07.html07-Apr-2004 18:09 6.7Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodeinsertbefore07
      [TXT]nodeinsertbefore08.html07-Apr-2004 18:09 6.6Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodeinsertbefore08
      [TXT]nodeinsertbefore09.html07-Apr-2004 18:09 7.5Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodeinsertbefore09
      [TXT]nodeinsertbefore10.html07-Apr-2004 18:09 7.9Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodeinsertbefore10
      [TXT]nodeinsertbefore11.html07-Apr-2004 18:09 10Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodeinsertbefore11
      [TXT]nodeinsertbefore12.html07-Apr-2004 18:09 7.2Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodeinsertbefore12
      [TXT]nodeinsertbefore13.html07-Apr-2004 18:09 7.9Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodeinsertbefore13
      [TXT]nodeinsertbefore14.html07-Apr-2004 18:09 6.8Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodeinsertbefore14
      [TXT]nodeinsertbefore15.html07-Apr-2004 18:09 11Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodeinsertbefore15
      [TXT]nodeinsertbefore16.html07-Apr-2004 18:09 7.3Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodeinsertbefore16
      [TXT]nodeinsertbefore17.html07-Apr-2004 18:09 7.7Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodeinsertbefore17
      [TXT]nodeinsertbefore18.html07-Apr-2004 18:09 8.4Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodeinsertbefore18
      [TXT]nodeinsertbefore19.html07-Apr-2004 18:09 6.5Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodeinsertbefore19
      [TXT]nodeinsertbefore20.html07-Apr-2004 18:09 6.6Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodeinsertbefore20
      [TXT]nodeinsertbefore21.html07-Apr-2004 18:09 6.5Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodeinsertbefore21
      [TXT]nodeinsertbefore22.html07-Apr-2004 18:09 7.0Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodeinsertbefore22
      [TXT]nodeinsertbefore23.html07-Apr-2004 18:09 7.3Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodeinsertbefore23
      [TXT]nodeinsertbefore24.html07-Apr-2004 18:09 6.4Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodeinsertbefore24
      [TXT]nodeinsertbefore25.html07-Apr-2004 18:09 7.6Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodeinsertbefore25
      [TXT]nodeisdefaultnamespace01.html07-Apr-2004 18:09 5.7Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodeisdefaultnamespace01
      [TXT]nodeisdefaultnamespace02.html07-Apr-2004 18:09 7.2Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodeisdefaultnamespace02
      [TXT]nodeisdefaultnamespace03.html07-Apr-2004 18:09 5.6Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodeisdefaultnamespace03
      [TXT]nodeisdefaultnamespace04.html07-Apr-2004 18:09 6.9Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodeisdefaultnamespace04
      [TXT]nodeisdefaultnamespace05.html07-Apr-2004 18:09 7.4Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodeisdefaultnamespace05
      [TXT]nodeisdefaultnamespace06.html07-Apr-2004 18:09 6.4Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodeisdefaultnamespace06
      [TXT]nodeisdefaultnamespace07.html07-Apr-2004 18:09 6.4Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodeisdefaultnamespace07
      [TXT]nodeisdefaultnamespace08.html07-Apr-2004 18:09 6.0Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodeisdefaultnamespace08
      [TXT]nodeisdefaultnamespace09.html07-Apr-2004 18:09 6.7Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodeisdefaultnamespace09
      [TXT]nodeisdefaultnamespace10.html07-Apr-2004 18:09 6.7Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodeisdefaultnamespace10
      [TXT]nodeisdefaultnamespace11.html07-Apr-2004 18:09 7.3Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodeisdefaultnamespace11
      [TXT]nodeisdefaultnamespace13.html07-Apr-2004 18:09 6.8Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodeisdefaultnamespace13
      [TXT]nodeisdefaultnamespace14.html07-Apr-2004 18:09 6.7Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodeisdefaultnamespace14
      [TXT]nodeisdefaultnamespace15.html07-Apr-2004 18:09 7.0Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodeisdefaultnamespace15
      [TXT]nodeisdefaultnamespace16.html07-Apr-2004 18:09 5.6Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodeisdefaultnamespace16
      [TXT]nodeisequalnode01.html07-Apr-2004 18:09 5.5Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodeisequalnode01
      [TXT]nodeisequalnode02.html07-Apr-2004 18:09 6.5Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodeisequalnode02
      [TXT]nodeisequalnode03.html07-Apr-2004 18:09 6.8Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodeisequalnode03
      [TXT]nodeisequalnode04.html07-Apr-2004 18:09 5.5Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodeisequalnode04
      [TXT]nodeisequalnode05.html07-Apr-2004 18:09 5.5Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodeisequalnode05
      [TXT]nodeisequalnode06.html07-Apr-2004 18:09 5.6Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodeisequalnode06
      [TXT]nodeisequalnode07.html07-Apr-2004 18:09 6.3Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodeisequalnode07
      [TXT]nodeisequalnode08.html07-Apr-2004 18:09 6.8Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodeisequalnode08
      [TXT]nodeisequalnode09.html07-Apr-2004 18:09 7.9Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodeisequalnode09
      [TXT]nodeisequalnode10.html07-Apr-2004 18:09 5.7Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodeisequalnode10
      [TXT]nodeisequalnode11.html07-Apr-2004 18:09 10Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodeisequalnode11
      [TXT]nodeisequalnode12.html07-Apr-2004 18:09 5.4Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodeisequalnode12
      [TXT]nodeisequalnode13.html07-Apr-2004 18:09 7.8Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodeisequalnode13
      [TXT]nodeisequalnode14.html07-Apr-2004 18:09 5.8Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodeisequalnode14
      [TXT]nodeisequalnode15.html07-Apr-2004 18:09 7.1Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodeisequalnode15
      [TXT]nodeisequalnode16.html07-Apr-2004 18:09 6.0Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodeisequalnode16
      [TXT]nodeisequalnode17.html07-Apr-2004 18:09 6.9Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodeisequalnode17
      [TXT]nodeisequalnode18.html07-Apr-2004 18:09 7.1Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodeisequalnode18
      [TXT]nodeisequalnode19.html07-Apr-2004 18:09 5.6Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodeisequalnode19
      [TXT]nodeisequalnode20.html07-Apr-2004 18:09 5.6Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodeisequalnode20
      [TXT]nodeisequalnode21.html07-Apr-2004 18:09 5.9Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodeisequalnode21
      [TXT]nodeisequalnode22.html07-Apr-2004 18:09 7.3Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodeisequalnode22
      [TXT]nodeisequalnode25.html07-Apr-2004 18:09 6.9Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodeisequalnode25
      [TXT]nodeisequalnode26.html07-Apr-2004 18:09 7.0Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodeisequalnode26
      [TXT]nodeisequalnode27.html07-Apr-2004 18:09 6.2Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodeisequalnode27
      [TXT]nodeisequalnode28.html07-Apr-2004 18:09 5.9Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodeisequalnode28
      [TXT]nodeisequalnode29.html07-Apr-2004 18:09 6.0Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodeisequalnode29
      [TXT]nodeisequalnode31.html07-Apr-2004 18:09 6.0Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodeisequalnode31
      [TXT]nodeisequalnode32.html07-Apr-2004 18:09 6.2Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodeisequalnode32
      [TXT]nodeissamenode01.html07-Apr-2004 18:09 5.5Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodeissamenode01
      [TXT]nodeissamenode02.html07-Apr-2004 18:09 5.3Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodeissamenode02
      [TXT]nodeissamenode03.html07-Apr-2004 18:09 5.6Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodeissamenode03
      [TXT]nodeissamenode04.html07-Apr-2004 18:09 5.6Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodeissamenode04
      [TXT]nodeissamenode05.html07-Apr-2004 18:09 5.3Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodeissamenode05
      [TXT]nodeissamenode06.html07-Apr-2004 18:09 6.1Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodeissamenode06
      [TXT]nodeissamenode07.html07-Apr-2004 18:09 5.8Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodeissamenode07
      [TXT]nodeissamenode08.html07-Apr-2004 18:09 5.8Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodeissamenode08
      [TXT]nodeissamenode09.html07-Apr-2004 18:09 5.5Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodeissamenode09
      [TXT]nodeissamenode10.html07-Apr-2004 18:09 6.4Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodeissamenode10
      [TXT]nodelookupnamespaceuri01.html07-Apr-2004 18:09 5.4Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodelookupnamespaceuri01
      [TXT]nodelookupnamespaceuri02.html07-Apr-2004 18:09 6.8Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodelookupnamespaceuri02
      [TXT]nodelookupnamespaceuri03.html07-Apr-2004 18:09 5.5Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodelookupnamespaceuri03
      [TXT]nodelookupnamespaceuri04.html07-Apr-2004 18:09 6.4Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodelookupnamespaceuri04
      [TXT]nodelookupnamespaceuri05.html07-Apr-2004 18:09 7.1Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodelookupnamespaceuri05
      [TXT]nodelookupnamespaceuri06.html07-Apr-2004 18:09 6.0Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodelookupnamespaceuri06
      [TXT]nodelookupnamespaceuri07.html07-Apr-2004 18:09 6.1Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodelookupnamespaceuri07
      [TXT]nodelookupnamespaceuri08.html07-Apr-2004 18:09 6.7Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodelookupnamespaceuri08
      [TXT]nodelookupnamespaceuri09.html07-Apr-2004 18:09 6.6Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodelookupnamespaceuri09
      [TXT]nodelookupnamespaceuri10.html07-Apr-2004 18:09 6.3Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodelookupnamespaceuri10
      [TXT]nodelookupnamespaceuri11.html07-Apr-2004 18:09 7.5Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodelookupnamespaceuri11
      [TXT]nodelookupnamespaceuri13.html07-Apr-2004 18:09 6.7Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodelookupnamespaceuri13
      [TXT]nodelookupnamespaceuri14.html07-Apr-2004 18:09 6.8Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodelookupnamespaceuri14
      [TXT]nodelookupnamespaceuri15.html07-Apr-2004 18:09 7.0Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodelookupnamespaceuri15
      [TXT]nodelookupnamespaceuri16.html07-Apr-2004 18:09 6.2Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodelookupnamespaceuri16
      [TXT]nodelookupnamespaceuri17.html07-Apr-2004 18:09 6.5Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodelookupnamespaceuri17
      [TXT]nodelookupnamespaceuri18.html07-Apr-2004 18:09 6.5Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodelookupnamespaceuri18
      [TXT]nodelookupnamespaceuri19.html07-Apr-2004 18:09 6.6Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodelookupnamespaceuri19
      [TXT]nodelookupnamespaceuri20.html07-Apr-2004 18:09 6.5Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodelookupnamespaceuri20
      [TXT]nodelookupprefix01.html07-Apr-2004 18:09 5.2Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodelookupprefix01
      [TXT]nodelookupprefix02.html07-Apr-2004 18:09 6.7Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodelookupprefix02
      [TXT]nodelookupprefix03.html07-Apr-2004 18:09 5.4Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodelookupprefix03
      [TXT]nodelookupprefix04.html07-Apr-2004 18:09 6.6Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodelookupprefix04
      [TXT]nodelookupprefix05.html07-Apr-2004 18:09 6.9Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodelookupprefix05
      [TXT]nodelookupprefix06.html07-Apr-2004 18:09 5.9Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodelookupprefix06
      [TXT]nodelookupprefix07.html07-Apr-2004 18:09 6.0Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodelookupprefix07
      [TXT]nodelookupprefix08.html07-Apr-2004 18:09 6.5Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodelookupprefix08
      [TXT]nodelookupprefix09.html07-Apr-2004 18:09 6.5Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodelookupprefix09
      [TXT]nodelookupprefix10.html07-Apr-2004 18:09 6.2Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodelookupprefix10
      [TXT]nodelookupprefix11.html07-Apr-2004 18:09 7.5Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodelookupprefix11
      [TXT]nodelookupprefix12.html07-Apr-2004 18:09 6.3Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodelookupprefix12
      [TXT]nodelookupprefix13.html07-Apr-2004 18:09 6.9Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodelookupprefix13
      [TXT]nodelookupprefix14.html07-Apr-2004 18:09 6.9Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodelookupprefix14
      [TXT]nodelookupprefix15.html07-Apr-2004 18:09 7.2Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodelookupprefix15
      [TXT]nodelookupprefix16.html07-Apr-2004 18:09 5.9Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodelookupprefix16
      [TXT]nodelookupprefix17.html07-Apr-2004 18:09 6.4Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodelookupprefix17
      [TXT]nodelookupprefix18.html07-Apr-2004 18:09 6.7Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodelookupprefix18
      [TXT]nodelookupprefix19.html07-Apr-2004 18:09 6.5Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodelookupprefix19
      [TXT]nodelookupprefix20.html07-Apr-2004 18:09 6.4Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodelookupprefix20
      [TXT]noderemovechild01.html07-Apr-2004 18:09 5.4Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/noderemovechild01
      [TXT]noderemovechild02.html07-Apr-2004 18:09 7.4Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/noderemovechild02
      [TXT]noderemovechild03.html07-Apr-2004 18:09 6.2Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/noderemovechild03
      [TXT]noderemovechild04.html07-Apr-2004 18:09 6.3Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/noderemovechild04
      [TXT]noderemovechild05.html07-Apr-2004 18:09 8.3Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/noderemovechild05
      [TXT]noderemovechild07.html07-Apr-2004 18:09 7.7Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/noderemovechild07
      [TXT]noderemovechild08.html07-Apr-2004 18:09 5.7Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/noderemovechild08
      [TXT]noderemovechild09.html07-Apr-2004 18:09 5.8Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/noderemovechild09
      [TXT]noderemovechild10.html07-Apr-2004 18:09 6.2Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/noderemovechild10
      [TXT]noderemovechild11.html07-Apr-2004 18:09 5.9Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/noderemovechild11
      [TXT]noderemovechild12.html07-Apr-2004 18:09 7.7Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/noderemovechild12
      [TXT]noderemovechild13.html07-Apr-2004 18:09 6.1Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/noderemovechild13
      [TXT]noderemovechild14.html07-Apr-2004 18:09 6.2Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/noderemovechild14
      [TXT]noderemovechild15.html07-Apr-2004 18:09 6.1Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/noderemovechild15
      [TXT]noderemovechild16.html07-Apr-2004 18:09 7.3Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/noderemovechild16
      [TXT]noderemovechild17.html07-Apr-2004 18:09 7.0Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/noderemovechild17
      [TXT]noderemovechild18.html07-Apr-2004 18:09 7.1Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/noderemovechild18
      [TXT]noderemovechild19.html07-Apr-2004 18:09 9.7Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/noderemovechild19
      [TXT]noderemovechild20.html07-Apr-2004 18:09 7.7Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/noderemovechild20
      [TXT]noderemovechild21.html07-Apr-2004 18:09 7.6Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/noderemovechild21
      [TXT]noderemovechild22.html07-Apr-2004 18:09 7.1Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/noderemovechild22
      [TXT]noderemovechild23.html07-Apr-2004 18:09 7.2Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/noderemovechild23
      [TXT]noderemovechild24.html07-Apr-2004 18:09 6.7Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/noderemovechild24
      [TXT]noderemovechild25.html07-Apr-2004 18:09 6.6Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/noderemovechild25
      [TXT]noderemovechild26.html07-Apr-2004 18:09 6.6Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/noderemovechild26
      [TXT]noderemovechild27.html07-Apr-2004 18:09 7.3Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/noderemovechild27
      [TXT]noderemovechild28.html07-Apr-2004 18:09 7.5Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/noderemovechild28
      [TXT]noderemovechild29.html07-Apr-2004 18:09 7.4Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/noderemovechild29
      [TXT]noderemovechild30.html07-Apr-2004 18:09 7.5Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/noderemovechild30
      [TXT]noderemovechild31.html07-Apr-2004 18:09 11Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/noderemovechild31
      [TXT]nodereplacechild01.html07-Apr-2004 18:09 6.3Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodereplacechild01
      [TXT]nodereplacechild02.html07-Apr-2004 18:09 5.5Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodereplacechild02
      [TXT]nodereplacechild03.html07-Apr-2004 18:09 7.1Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodereplacechild03
      [TXT]nodereplacechild04.html07-Apr-2004 18:09 6.4Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodereplacechild04
      [TXT]nodereplacechild06.html07-Apr-2004 18:09 7.2Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodereplacechild06
      [TXT]nodereplacechild07.html07-Apr-2004 18:09 7.4Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodereplacechild07
      [TXT]nodereplacechild08.html07-Apr-2004 18:09 7.7Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodereplacechild08
      [TXT]nodereplacechild10.html07-Apr-2004 18:09 8.4Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodereplacechild10
      [TXT]nodereplacechild12.html07-Apr-2004 18:09 7.4Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodereplacechild12
      [TXT]nodereplacechild13.html07-Apr-2004 18:09 7.9Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodereplacechild13
      [TXT]nodereplacechild14.html07-Apr-2004 18:09 8.2Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodereplacechild14
      [TXT]nodereplacechild15.html07-Apr-2004 18:09 7.3Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodereplacechild15
      [TXT]nodereplacechild16.html07-Apr-2004 18:09 6.5Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodereplacechild16
      [TXT]nodereplacechild17.html07-Apr-2004 18:09 7.2Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodereplacechild17
      [TXT]nodereplacechild18.html07-Apr-2004 18:09 7.3Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodereplacechild18
      [TXT]nodereplacechild19.html07-Apr-2004 18:09 6.5Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodereplacechild19
      [TXT]nodereplacechild20.html07-Apr-2004 18:09 6.7Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodereplacechild20
      [TXT]nodereplacechild21.html07-Apr-2004 18:09 9.1Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodereplacechild21
      [TXT]nodereplacechild22.html07-Apr-2004 18:09 8.4Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodereplacechild22
      [TXT]nodereplacechild23.html07-Apr-2004 18:09 11Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodereplacechild23
      [TXT]nodereplacechild24.html07-Apr-2004 18:09 6.5Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodereplacechild24
      [TXT]nodereplacechild25.html07-Apr-2004 18:09 7.8Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodereplacechild25
      [TXT]nodereplacechild26.html07-Apr-2004 18:09 6.6Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodereplacechild26
      [TXT]nodereplacechild27.html07-Apr-2004 18:09 8.1Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodereplacechild27
      [TXT]nodereplacechild28.html07-Apr-2004 18:09 7.6Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodereplacechild28
      [TXT]nodereplacechild29.html07-Apr-2004 18:09 6.6Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodereplacechild29
      [TXT]nodereplacechild30.html07-Apr-2004 18:09 13Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodereplacechild30
      [TXT]nodereplacechild31.html07-Apr-2004 18:09 7.6Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodereplacechild31
      [TXT]nodereplacechild32.html07-Apr-2004 18:09 7.7Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodereplacechild32
      [TXT]nodereplacechild33.html07-Apr-2004 18:09 6.5Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodereplacechild33
      [TXT]nodereplacechild34.html07-Apr-2004 18:09 6.4Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodereplacechild34
      [TXT]nodereplacechild35.html07-Apr-2004 18:09 6.8Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodereplacechild35
      [TXT]nodereplacechild36.html07-Apr-2004 18:09 6.4Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodereplacechild36
      [TXT]nodereplacechild37.html07-Apr-2004 18:09 7.3Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodereplacechild37
      [TXT]nodereplacechild38.html07-Apr-2004 18:09 12Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodereplacechild38
      [TXT]nodereplacechild39.html07-Apr-2004 18:09 7.2Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodereplacechild39
      [TXT]nodereplacechild40.html07-Apr-2004 18:09 7.5Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodereplacechild40
      [TXT]nodesettextcontent01.html07-Apr-2004 18:09 5.8Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodesettextcontent01
      [TXT]nodesettextcontent02.html07-Apr-2004 18:09 7.8Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodesettextcontent02
      [TXT]nodesettextcontent03.html07-Apr-2004 18:09 5.4Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodesettextcontent03
      [TXT]nodesettextcontent04.html07-Apr-2004 18:09 5.9Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodesettextcontent04
      [TXT]nodesettextcontent05.html07-Apr-2004 18:09 5.9Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodesettextcontent05
      [TXT]nodesettextcontent06.html07-Apr-2004 18:09 6.2Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodesettextcontent06
      [TXT]nodesettextcontent07.html07-Apr-2004 18:09 5.9Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodesettextcontent07
      [TXT]nodesettextcontent08.html07-Apr-2004 18:09 6.1Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodesettextcontent08
      [TXT]nodesettextcontent10.html07-Apr-2004 18:09 8.0Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodesettextcontent10
      [TXT]nodesettextcontent11.html07-Apr-2004 18:09 8.3Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodesettextcontent11
      [TXT]nodesettextcontent12.html07-Apr-2004 18:09 6.2Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodesettextcontent12
      [TXT]nodesettextcontent13.html07-Apr-2004 18:09 6.1Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodesettextcontent13
      [TXT]nodesetuserdata01.html07-Apr-2004 18:09 5.6Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodesetuserdata01
      [TXT]nodesetuserdata02.html07-Apr-2004 18:09 5.7Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodesetuserdata02
      [TXT]nodesetuserdata03.html07-Apr-2004 18:09 6.6Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodesetuserdata03
      [TXT]nodesetuserdata04.html07-Apr-2004 18:09 7.0Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodesetuserdata04
      [TXT]nodesetuserdata05.html07-Apr-2004 18:09 7.4Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodesetuserdata05
      [TXT]nodesetuserdata06.html07-Apr-2004 18:09 7.0Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodesetuserdata06
      [TXT]nodesetuserdata07.html07-Apr-2004 18:09 7.1Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodesetuserdata07
      [TXT]nodesetuserdata08.html07-Apr-2004 18:09 7.4Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodesetuserdata08
      [TXT]nodesetuserdata09.html07-Apr-2004 18:09 6.0Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodesetuserdata09
      [TXT]nodesetuserdata10.html07-Apr-2004 18:09 7.8Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/nodesetuserdata10
      [TXT]normalizecharacters01.html07-Apr-2004 18:09 8.5Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/normalizecharacters01
      [TXT]normalizecharacters02.html07-Apr-2004 18:09 9.4Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/normalizecharacters02
      [TXT]normalizecharacters03.html07-Apr-2004 18:09 8.4Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/normalizecharacters03
      [TXT]normalizecharacters04.html07-Apr-2004 18:09 9.3Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/normalizecharacters04
      [TXT]normalizecharacters05.html07-Apr-2004 18:09 8.5Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/normalizecharacters05
      [TXT]normalizecharacters06.html07-Apr-2004 18:09 9.4Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/normalizecharacters06
      [TXT]normalizecharacters07.html07-Apr-2004 18:09 8.4Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/normalizecharacters07
      [TXT]normalizecharacters08.html07-Apr-2004 18:09 9.3Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/normalizecharacters08
      [TXT]splitcdatasections01.html07-Apr-2004 18:09 7.2Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/splitcdatasections01
      [TXT]textiselementcontentwhitespace01.html07-Apr-2004 18:09 5.5Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/textiselementcontentwhitespace01
      [TXT]textiselementcontentwhitespace02.html07-Apr-2004 18:09 6.0Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/textiselementcontentwhitespace02
      [TXT]textiselementcontentwhitespace03.html07-Apr-2004 18:09 6.5Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/textiselementcontentwhitespace03
      [TXT]textiselementcontentwhitespace04.html07-Apr-2004 18:09 8.1Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/textiselementcontentwhitespace04
      [TXT]textiselementcontentwhitespace05.html07-Apr-2004 18:09 9.6Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/textiselementcontentwhitespace05
      [TXT]textiselementcontentwhitespace06.html07-Apr-2004 18:09 9.8Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/textiselementcontentwhitespace06
      [TXT]textreplacewholetext01.html07-Apr-2004 18:09 6.3Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/textreplacewholetext01
      [TXT]textreplacewholetext02.html07-Apr-2004 18:09 5.9Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/textreplacewholetext02
      [TXT]textreplacewholetext03.html07-Apr-2004 18:09 5.7Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/textreplacewholetext03
      [TXT]textreplacewholetext04.html07-Apr-2004 18:09 5.3Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/textreplacewholetext04
      [TXT]textreplacewholetext05.html07-Apr-2004 18:09 7.2Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/textreplacewholetext05
      [TXT]textreplacewholetext06.html07-Apr-2004 18:09 8.9Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/textreplacewholetext06
      [TXT]textreplacewholetext07.html07-Apr-2004 18:09 8.9Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/textreplacewholetext07
      [TXT]textreplacewholetext08.html07-Apr-2004 18:09 7.0Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/textreplacewholetext08
      [TXT]textwholetext01.html07-Apr-2004 18:09 5.8Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/textwholetext01
      [TXT]textwholetext02.html07-Apr-2004 18:09 6.3Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/textwholetext02
      [TXT]textwholetext03.html07-Apr-2004 18:09 6.1Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/textwholetext03
      [TXT]typeinfogettypename03.html07-Apr-2004 18:09 6.9Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/typeinfogettypename03
      [TXT]typeinfogettypename04.html07-Apr-2004 18:09 6.9Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/typeinfogettypename04
      [TXT]typeinfogettypenamespace01.html07-Apr-2004 18:09 7.2Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/typeinfogettypenamespace01
      [TXT]typeinfogettypenamespace03.html07-Apr-2004 18:09 7.1Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/typeinfogettypenamespace03
      [TXT]typeinfogettypenamespace04.html07-Apr-2004 18:09 6.9Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/typeinfogettypenamespace04
      [TXT]typeinfoisderivedfrom01.html07-Apr-2004 18:09 6.8Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/typeinfoisderivedfrom01
      [TXT]typeinfoisderivedfrom02.html07-Apr-2004 18:09 7.8Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/typeinfoisderivedfrom02
      [TXT]typeinfoisderivedfrom03.html07-Apr-2004 18:09 7.0Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/typeinfoisderivedfrom03
      [TXT]typeinfoisderivedfrom04.html07-Apr-2004 18:09 6.9Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/typeinfoisderivedfrom04
      [TXT]typeinfoisderivedfrom05.html07-Apr-2004 18:09 7.0Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/typeinfoisderivedfrom05
      [TXT]typeinfoisderivedfrom06.html07-Apr-2004 18:09 7.0Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/typeinfoisderivedfrom06
      [TXT]typeinfoisderivedfrom07.html07-Apr-2004 18:09 6.9Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/typeinfoisderivedfrom07
      [TXT]typeinfoisderivedfrom08.html07-Apr-2004 18:09 6.9Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/typeinfoisderivedfrom08
      [TXT]typeinfoisderivedfrom09.html07-Apr-2004 18:09 7.0Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/typeinfoisderivedfrom09
      [TXT]typeinfoisderivedfrom10.html07-Apr-2004 18:09 6.9Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/typeinfoisderivedfrom10
      [TXT]typeinfoisderivedfrom11.html07-Apr-2004 18:09 7.0Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/typeinfoisderivedfrom11
      [TXT]typeinfoisderivedfrom12.html07-Apr-2004 18:09 6.9Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/typeinfoisderivedfrom12
      [TXT]typeinfoisderivedfrom13.html07-Apr-2004 18:09 7.0Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/typeinfoisderivedfrom13
      [TXT]typeinfoisderivedfrom14.html07-Apr-2004 18:09 8.2Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/typeinfoisderivedfrom14
      [TXT]typeinfoisderivedfrom15.html07-Apr-2004 18:09 6.4Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/typeinfoisderivedfrom15
      [TXT]typeinfoisderivedfrom16.html07-Apr-2004 18:09 6.4Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/typeinfoisderivedfrom16
      [TXT]typeinfoisderivedfrom17.html07-Apr-2004 18:09 6.5Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/typeinfoisderivedfrom17
      [TXT]typeinfoisderivedfrom18.html07-Apr-2004 18:09 6.6Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/typeinfoisderivedfrom18
      [TXT]typeinfoisderivedfrom19.html07-Apr-2004 18:09 6.5Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/typeinfoisderivedfrom19
      [TXT]typeinfoisderivedfrom20.html07-Apr-2004 18:09 6.0Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/typeinfoisderivedfrom20
      [TXT]typeinfoisderivedfrom21.html07-Apr-2004 18:09 7.7Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/typeinfoisderivedfrom21
      [TXT]typeinfoisderivedfrom22.html07-Apr-2004 18:09 6.5Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/typeinfoisderivedfrom22
      [TXT]typeinfoisderivedfrom23.html07-Apr-2004 18:09 6.5Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/typeinfoisderivedfrom23
      [TXT]typeinfoisderivedfrom24.html07-Apr-2004 18:09 6.5Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/typeinfoisderivedfrom24
      [TXT]typeinfoisderivedfrom25.html07-Apr-2004 18:09 6.5Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/typeinfoisderivedfrom25
      [TXT]typeinfoisderivedfrom26.html07-Apr-2004 18:09 6.5Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/typeinfoisderivedfrom26
      [TXT]typeinfoisderivedfrom27.html07-Apr-2004 18:09 6.5Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/typeinfoisderivedfrom27
      [TXT]typeinfoisderivedfrom28.html07-Apr-2004 18:09 7.8Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/typeinfoisderivedfrom28
      [TXT]typeinfoisderivedfrom29.html07-Apr-2004 18:09 6.2Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/typeinfoisderivedfrom29
      [TXT]typeinfoisderivedfrom30.html07-Apr-2004 18:09 6.1Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/typeinfoisderivedfrom30
      [TXT]typeinfoisderivedfrom31.html07-Apr-2004 18:09 6.2Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/typeinfoisderivedfrom31
      [TXT]typeinfoisderivedfrom32.html07-Apr-2004 18:09 6.2Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/typeinfoisderivedfrom32
      [TXT]typeinfoisderivedfrom33.html07-Apr-2004 18:09 6.1Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/typeinfoisderivedfrom33
      [TXT]typeinfoisderivedfrom34.html07-Apr-2004 18:09 6.1Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/typeinfoisderivedfrom34
      [TXT]typeinfoisderivedfrom35.html07-Apr-2004 18:09 6.2Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/typeinfoisderivedfrom35
      [TXT]typeinfoisderivedfrom36.html07-Apr-2004 18:09 6.2Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/typeinfoisderivedfrom36
      [TXT]typeinfoisderivedfrom37.html07-Apr-2004 18:09 6.1Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/typeinfoisderivedfrom37
      [TXT]typeinfoisderivedfrom38.html07-Apr-2004 18:09 6.2Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/typeinfoisderivedfrom38
      [TXT]typeinfoisderivedfrom39.html07-Apr-2004 18:09 6.4Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/typeinfoisderivedfrom39
      [TXT]typeinfoisderivedfrom40.html07-Apr-2004 18:09 6.6Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/typeinfoisderivedfrom40
      [TXT]typeinfoisderivedfrom41.html07-Apr-2004 18:09 6.6Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/typeinfoisderivedfrom41
      [TXT]typeinfoisderivedfrom42.html07-Apr-2004 18:09 6.5Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/typeinfoisderivedfrom42
      [TXT]typeinfoisderivedfrom43.html07-Apr-2004 18:09 6.3Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/typeinfoisderivedfrom43
      [TXT]typeinfoisderivedfrom44.html07-Apr-2004 18:09 6.4Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/typeinfoisderivedfrom44
      [TXT]typeinfoisderivedfrom45.html07-Apr-2004 18:09 6.4Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/typeinfoisderivedfrom45
      [TXT]typeinfoisderivedfrom46.html07-Apr-2004 18:09 6.4Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/typeinfoisderivedfrom46
      [TXT]typeinfoisderivedfrom47.html07-Apr-2004 18:09 6.3Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/typeinfoisderivedfrom47
      [TXT]typeinfoisderivedfrom48.html07-Apr-2004 18:09 6.4Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/typeinfoisderivedfrom48
      [TXT]typeinfoisderivedfrom49.html07-Apr-2004 18:09 6.1Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/typeinfoisderivedfrom49
      [TXT]typeinfoisderivedfrom50.html07-Apr-2004 18:09 6.1Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/typeinfoisderivedfrom50
      [TXT]typeinfoisderivedfrom51.html07-Apr-2004 18:09 6.2Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/typeinfoisderivedfrom51
      [TXT]typeinfoisderivedfrom52.html07-Apr-2004 18:09 6.2Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/typeinfoisderivedfrom52
      [TXT]typeinfoisderivedfrom53.html07-Apr-2004 18:09 6.2Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/typeinfoisderivedfrom53
      [TXT]typeinfoisderivedfrom54.html07-Apr-2004 18:09 6.1Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/typeinfoisderivedfrom54
      [TXT]typeinfoisderivedfrom55.html07-Apr-2004 18:09 6.1Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/typeinfoisderivedfrom55
      [TXT]typeinfoisderivedfrom56.html07-Apr-2004 18:09 6.1Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/typeinfoisderivedfrom56
      [TXT]typeinfoisderivedfrom57.html07-Apr-2004 18:09 6.1Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/typeinfoisderivedfrom57
      [TXT]typeinfoisderivedfrom58.html07-Apr-2004 18:09 6.2Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/typeinfoisderivedfrom58
      [TXT]typeinfoisderivedfrom59.html07-Apr-2004 18:09 6.4Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/typeinfoisderivedfrom59
      [TXT]typeinfoisderivedfrom60.html07-Apr-2004 18:09 6.0Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/typeinfoisderivedfrom60
      [TXT]typeinfoisderivedfrom61.html07-Apr-2004 18:09 5.9Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/typeinfoisderivedfrom61
      [TXT]typeinfoisderivedfrom62.html07-Apr-2004 18:09 5.9Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/typeinfoisderivedfrom62
      [TXT]typeinfoisderivedfrom63.html07-Apr-2004 18:09 6.8Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/typeinfoisderivedfrom63
      [TXT]typeinfoisderivedfrom64.html07-Apr-2004 18:09 6.9Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/typeinfoisderivedfrom64
      [TXT]typeinfoisderivedfrom65.html07-Apr-2004 18:09 6.7Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/typeinfoisderivedfrom65
      [TXT]typeinfoisderivedfrom66.html07-Apr-2004 18:09 7.0Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/typeinfoisderivedfrom66
      [TXT]typeinfoisderivedfrom67.html07-Apr-2004 18:09 6.4Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/typeinfoisderivedfrom67
      [TXT]typeinfoisderivedfrom68.html07-Apr-2004 18:09 6.3Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/typeinfoisderivedfrom68
      [TXT]typeinfoisderivedfrom69.html07-Apr-2004 18:09 6.4Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/typeinfoisderivedfrom69
      [TXT]typeinfoisderivedfrom70.html07-Apr-2004 18:09 6.3Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/typeinfoisderivedfrom70
      [TXT]typeinfoisderivedfrom71.html07-Apr-2004 18:09 6.3Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/typeinfoisderivedfrom71
      [TXT]typeinfoisderivedfrom72.html07-Apr-2004 18:09 6.3Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/typeinfoisderivedfrom72
      [TXT]typeinfoisderivedfrom73.html07-Apr-2004 18:09 6.4Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/typeinfoisderivedfrom73
      [TXT]userdatahandler01.html07-Apr-2004 18:09 13Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/userdatahandler01
      [TXT]userdatahandler02.html07-Apr-2004 18:09 12Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/userdatahandler02
      [TXT]userdatahandler03.html07-Apr-2004 18:09 13Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/userdatahandler03
      [TXT]userdatahandler04.html07-Apr-2004 18:09 13Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/userdatahandler04
      [TXT]wellformed01.html07-Apr-2004 18:09 11Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/wellformed01
      [TXT]wellformed02.html07-Apr-2004 18:09 9.5Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/wellformed02
      [TXT]wellformed03.html07-Apr-2004 18:09 11Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/wellformed03
      [TXT]wellformed04.html07-Apr-2004 18:09 9.9Khttp://www.w3.org/2001/DOM-Test-Suite/level3/core/wellformed04

      jsdom-19.0.0/test/to-port-to-wpts/level3/core/files/orig/robots.txt000066400000000000000000000033051415223704400251530ustar00rootroot00000000000000# # robots.txt for http://www.w3.org/ # # $Id: robots.txt,v 1.60 2010/05/28 07:27:43 dom Exp $ # # For use by search.w3.org User-agent: W3C-gsa Disallow: /Out-Of-Date User-agent: W3T_SE Disallow: /Out-Of-Date User-agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT; MS Search 4.0 Robot) Disallow: / # W3C Link checker User-agent: W3C-checklink Disallow: # exclude some access-controlled areas User-agent: * Disallow: /2004/ontaria/basic Disallow: /Team/ Disallow: /Project Disallow: /Web Disallow: /Systems Disallow: /History Disallow: /Out-Of-Date Disallow: /2002/02/mid Disallow: /mid/ Disallow: /2005/06/blog/ Disallow: /2004/08/W3CTalks Disallow: /2007/11/Talks/search Disallow: /People/all/ Disallow: /RDF/Validator/ARPServlet Disallow: /2003/03/Translations/byLanguage Disallow: /2003/03/Translations/byTechnology Disallow: /2005/11/Translations/Query #Disallow: /2003/glossary/subglossary/ #Disallow: /2001/07/pubrules-checker #shouldnt get transparent proxies but will ml links of things like pubrules Disallow: /2000/06/webdata/xslt Disallow: /2000/09/webdata/xslt Disallow: /2005/08/online_xslt/xslt Disallow: /Bugs/ Disallow: /Search/Mail/Public/ Disallow: /2006/02/chartergen Disallow: /2004/01/pp-impl Disallow: /Consortium/supporters Disallow: /2007/08/pyRdfa/ # exclude some wikis that are full of spam User-agent: * Disallow: /2001/sw/sweo/group/wiki/ Disallow: /2005/Incubator/geo/Wiki/ Disallow: /2005/Incubator/mmsem/wiki/ Disallow: /2005/Incubator/urw3/wiki/ Disallow: /2005/MWI/BPWG/techs/ Disallow: /2005/MWI/Steer/wiki/ Disallow: /2006/appformats/group/ Disallow: /2006/tsdtf/ Disallow: /2006/ubiweb-wiki/ Disallow: /2006/webapi/group/ Disallow: /2007/xmlsec/wiki/ Disallow: /MarkUp/Forms/Group/wiki/ jsdom-19.0.0/test/to-port-to-wpts/level3/core/files/orig/svgtest.js000066400000000000000000000000001415223704400251240ustar00rootroot00000000000000jsdom-19.0.0/test/to-port-to-wpts/level3/core/files/orig/svgunit.js000066400000000000000000000000001415223704400251240ustar00rootroot00000000000000jsdom-19.0.0/test/to-port-to-wpts/level3/core/files/orig/text.gif000066400000000000000000000003451415223704400245560ustar00rootroot00000000000000GIF89a333!NThis art is in the public domain. Kevin Hughes, kevinh@eit.com, September 1995!,X80 @#i;U"qDR' n Jn(<:{PټVEnY2~Oڍ ;jsdom-19.0.0/test/to-port-to-wpts/level3/core/files/orig/typeinfo.svg000066400000000000000000000020571415223704400254630ustar00rootroot00000000000000 ]>

      foo1 foo2

      1unbounded

      12748

      3.1415926 2.718

      jsdom-19.0.0/test/to-port-to-wpts/level3/core/files/orig/typeinfo.svg.xsd000066400000000000000000000035141415223704400262570ustar00rootroot00000000000000 jsdom-19.0.0/test/to-port-to-wpts/level3/core/files/orig/typeinfo.xhtml000066400000000000000000000014541415223704400260200ustar00rootroot00000000000000 ]> hc_staff

      foo1 foo2

      1unbounded

      12748

      3.1415926 2.718

      jsdom-19.0.0/test/to-port-to-wpts/level3/core/files/orig/typeinfo.xml000066400000000000000000000014541415223704400254640ustar00rootroot00000000000000 ]> hc_staff

      foo1 foo2

      1unbounded

      12748

      3.1415926 2.718

      jsdom-19.0.0/test/to-port-to-wpts/level3/core/files/orig/typeinfo.xsd000066400000000000000000000061371415223704400254650ustar00rootroot00000000000000 jsdom-19.0.0/test/to-port-to-wpts/level3/core/files/orig/unknown.gif000066400000000000000000000003651415223704400252730ustar00rootroot00000000000000GIF89a333!NThis art is in the public domain. Kevin Hughes, kevinh@eit.com, September 1995!,h80 @#i;a"Qyʵ.J 70֧#$ @*,K|'"-K<%$`[˓j% jsdom-19.0.0/test/to-port-to-wpts/level3/core/files/orig/xhtml-special.ent000066400000000000000000000100431415223704400263610ustar00rootroot00000000000000 jsdom-19.0.0/test/to-port-to-wpts/level3/core/files/orig/xhtml-symbol.ent000066400000000000000000000330301415223704400262470ustar00rootroot00000000000000 jsdom-19.0.0/test/to-port-to-wpts/level3/core/files/orig/xhtml1-frameset.dtd000066400000000000000000001002651415223704400266230ustar00rootroot00000000000000 %HTMLlat1; %HTMLsymbol; %HTMLspecial; jsdom-19.0.0/test/to-port-to-wpts/level3/core/files/orig/xhtml1-strict.dtd000066400000000000000000000033621415223704400263250ustar00rootroot00000000000000 jsdom-19.0.0/test/to-port-to-wpts/level3/core/files/orig/xhtml1-transitional.dtd000066400000000000000000000765571415223704400275440ustar00rootroot00000000000000 %HTMLlat1; %HTMLsymbol; %HTMLspecial; jsdom-19.0.0/test/to-port-to-wpts/level3/core/files/typeinfo.xml.js000066400000000000000000000014601415223704400251340ustar00rootroot00000000000000/* ]> hc_staff

      foo1 foo2

      1unbounded

      12748

      3.1415926 2.718

      */jsdom-19.0.0/test/to-port-to-wpts/level3/textContent.js000066400000000000000000000013341415223704400227650ustar00rootroot00000000000000const { assert } = require("chai"); const { describe, specify } = require("mocha-sugar-free"); var hc_staff = require("../level1/core/files/hc_staff.xml"); // Most of the level3 tests fail, so we don't turn them on by default. We extracted out one that passes into this file. describe("level3/textContent", () => { specify("nodesettextcontent07", () => { var success; var doc; var elemList; var elem; var txt; var textContent; doc = hc_staff.hc_staff(); elemList = doc.getElementsByTagName("em"); elem = elemList.item(0); txt = elem.firstChild; txt.textContent = "Text"; textContent = txt.textContent; assert.equal(textContent, "Text", 'nodegettextcontent10'); }); }); jsdom-19.0.0/test/to-port-to-wpts/level3/xpath.js000066400000000000000000003240541415223704400216010ustar00rootroot00000000000000const { assert } = require("chai"); const { describe, specify } = require("mocha-sugar-free"); const { JSDOM } = require("../../.."); const xpath = require('../../../lib/jsdom/level3/xpath')((new JSDOM()).window); const domTestHelper = require('../files/DOMTestCase'); function all1(re, s) { var l = []; while (s.length) { var m = re.exec(s); if (!m) break; l.push(m[1]); s = s.substr(m[0].length); } return l; } describe("xpath", { skipIfBrowser: true }, () => { specify("testTokenizeRegexp", function() { var re = xpath.Stream.prototype.re; assert.deepEqual(['8', 'a'], all1(re, '8a')); assert.deepEqual(['8', 'a'], all1(re, ' 8a')); assert.deepEqual(['fun'], all1(re, 'fun')); assert.deepEqual(['hi', '+', '3'], all1(re, 'hi+3')); assert.deepEqual(['fun', '(', ')'], all1(re, 'fun()')); assert.deepEqual(['..', '/', 'a', '//', 'b'], all1(re, '../a//b')); assert.deepEqual(['1', '<=', '2', '<', '3', '>=', '4', '=', '5', '!=', '6'], all1(re, '1<=2<3>=4=5!=6')); assert.deepEqual(['<', '='], all1(re, '< =')); assert.deepEqual(['a','::','b'], all1(re, 'a::b')); assert.deepEqual(['a','::','b'], all1(re, 'a :: b')); assert.deepEqual(['a:b'], all1(re, 'a:b')); assert.deepEqual(['a'], all1(re, 'a : b')); // can't tokenize : alone assert.deepEqual(['a:b', '::', 'c'], all1(re, 'a:b::c')); assert.deepEqual(['a', '::', 'b:c'], all1(re, 'a::b:c')); assert.deepEqual(['a', '::', 'b:c'], all1(re, 'a::b:c')); assert.deepEqual(['"hi there\'"'], all1(re, '"hi there\'"')); assert.deepEqual(['*'], all1(re, '*')); assert.deepEqual(['ncname:*'], all1(re, 'ncname:*')); assert.deepEqual(['q:name'], all1(re, 'q:name:*')); // can't tokenize : alone assert.deepEqual(['-', 'b'], all1(re, '-b')); assert.deepEqual(['a-b'], all1(re, 'a-b')); assert.deepEqual(['a', '-', 'b'], all1(re, 'a -b')); assert.deepEqual(['a', '-', 'b'], all1(re, 'a - b')); assert.deepEqual(['.3'], all1(re, '.3')); }); specify("testPeekPop", function() { var s = new xpath.Stream('a b c'); assert.equal('a', s.peek()); assert.equal(' b c', s.str); assert.equal('a', s.pop()); assert.equal('b', s.pop()); assert.equal('c', s.pop()); assert.equal(null, s.pop()); }); specify("testPopFuncName", function() { var s = new xpath.Stream('f( node( mod( string( comment()))))'); assert.equal('f', s.trypopfuncname()); assert.equal('(', s.pop()); assert.equal(null, s.trypopfuncname()); assert.equal('node', s.pop()); assert.equal('(', s.pop()); assert.equal('mod', s.trypopfuncname()); assert.equal('(', s.pop()); assert.equal('string', s.trypopfuncname()); assert.equal('(', s.pop()); assert.equal(null, s.trypopfuncname()); assert.equal('comment', s.pop()); assert.equal('(', s.pop()); assert.equal(')', s.pop()); assert.equal(')', s.pop()); assert.equal(')', s.pop()); assert.equal(')', s.pop()); assert.equal(')', s.pop()); assert.equal(null, s.trypopfuncname()); assert.equal(null, s.pop()); }); specify("testPopFuncWithSpaces", function() { var s = new xpath.Stream('f(n-s(" "), 2, 3)'); assert.equal('f', s.trypopfuncname()); assert.equal('(', s.pop()); assert.equal('n-s', s.trypopfuncname()); assert.equal('(', s.pop()); assert.equal(' ', s.trypopliteral()); assert.equal(')', s.pop()); assert.equal(',', s.pop()); assert.equal('2', s.pop()); assert.equal(',', s.pop()); assert.equal('3', s.pop()); assert.equal(')', s.pop()); assert.equal(null, s.pop()); }); specify("testTryPopNameTest", function() { var s = new xpath.Stream('a:b + c:* + *'); assert.equal('a:b', s.trypopnametest()); assert.equal(null, s.trypopnametest()); assert.equal('+', s.pop()); assert.equal('c:*', s.trypopnametest()); assert.equal(null, s.trypopnametest()); assert.equal('+', s.pop()); assert.equal('*', s.trypopnametest()); assert.equal(null, s.trypopnametest()); assert.equal(null, s.pop()); }); specify("testTryPopLiteral", function() { var s = new xpath.Stream('"ab" + \'c d\' e "'); // dangling " at end assert.equal('ab', s.trypopliteral()); assert.equal(null, s.trypopliteral()); assert.equal('+', s.pop()); assert.equal('c d', s.trypopliteral()); assert.equal(null, s.trypopliteral()); assert.equal('e', s.pop()); assert.equal(null, s.trypopliteral()); // dangling " doesn't become a token. assert.equal(null, s.pop()); }); specify("testTryPopNumber", function() { var s = new xpath.Stream('.2 + 3.4 -5 .'); assert.equal(.2, s.trypopnumber()); assert.equal(null, s.trypopnumber()); assert.equal('+', s.pop()); assert.equal('3.4', s.trypopnumber()); assert.equal(null, s.trypopnumber()); assert.equal('-', s.pop()); assert.equal('5', s.trypopnumber()); // . by itself isn't a number. assert.equal(null, s.trypopnumber()); assert.equal('.', s.pop()); assert.equal(null, s.trypopnumber()); // dangling " doesn't become a token. assert.equal(null, s.pop()); }); specify("testTryPopVarRef", function() { var s = new xpath.Stream('$a + $b:c $'); assert.equal('a', s.trypopvarref()); assert.equal(null, s.trypopvarref()); assert.equal('+', s.pop()); assert.equal('b:c', s.trypopvarref()); assert.equal(null, s.trypopvarref()); assert.equal(null, s.pop()); }); var astFactory = { node: function() {return Array.prototype.slice.call(arguments);}, i: 0, }; specify("testParseNumber", function() { var s = new xpath.Stream('32'); assert.deepEqual(32, xpath.parse(s, astFactory)); }); specify("testParseLiteral", function() { var s = new xpath.Stream('"hi"'); assert.deepEqual("hi", xpath.parse(s, astFactory)); }); specify("testParseFunctionCall", function() { var s = new xpath.Stream('concat(1, 1+1, "hi")'); assert.deepEqual(['FunctionCall', 'concat', [1, ['+', 1, 1], 'hi']], xpath.parse(s, astFactory)); }); specify("testParseFunctionOfEmptyString", function() { var s = new xpath.Stream('string("")'); assert.deepEqual(['FunctionCall', 'string', [""]], xpath.parse(s, astFactory)); }); specify("testParseVariableReference", function() { var s = new xpath.Stream('$hi'); assert.deepEqual(['VariableReference', 'hi'], xpath.parse(s, astFactory)); }); specify("testParsePrimative", function() { var s = new xpath.Stream('32 + -1 + "3"'); assert.deepEqual(['+', ['+', 32, ['UnaryMinus', 1]], '3'], xpath.parse(s, astFactory)); }); specify("testPrimaryParens", function() { var s = new xpath.Stream('(div)'); assert.deepEqual(['PathExpr', ['Axis', 'child', 'element', 'div']], xpath.parse(s, astFactory)); }); specify("testParseStepShorthands", function() { var s = new xpath.Stream('../.'); assert.deepEqual( [ 'PathExpr', [ '/', [ 'Axis', 'parent', 'node' ], [ 'Axis', 'self', 'node' ] ] ], xpath.parse(s, astFactory)); }); specify("testParseWildcard", function() { var s = new xpath.Stream('*/self::*/@*'); assert.deepEqual( [ 'PathExpr', [ '/', [ '/', [ 'Axis', 'child', 'element', '*' ], [ 'Axis', 'self', 'element', '*' ] ], [ 'Axis', 'attribute', 'attribute', '*' ] ] ], xpath.parse(s, astFactory)); }); specify("testParseFilter", function() { // tests FilterExpr, which is Primary followed by predicates. // Not to be confused with Step, which is node test followed by predicate. var s = new xpath.Stream('1[2][3]'); assert.deepEqual(['Predicate', ['Predicate', 1, 2], 3], xpath.parse(s, astFactory)); }); specify("testParseStepWithPredicate", function() { // tests Step, which is node test followed by predicate. // Not to be confused with FilterExpr, which is Primary followed by predicates. var s = new xpath.Stream('a[2][3]'); assert.deepEqual(['PathExpr', ['Predicate', ['Predicate', ['Axis', 'child', 'element', 'a'], 2], 3]], xpath.parse(s, astFactory)); }); specify("testParsePathWithPredicate", function() { // tests Step, which is node test followed by predicate. // Not to be confused with FilterExpr, which is Primary followed by predicates. var s = new xpath.Stream('a/b[1]'); assert.deepEqual(['PathExpr', [ '/', [ 'Axis', 'child', 'element', 'a' ], [ 'Predicate', [ 'Axis', 'child', 'element', 'b' ], 1 ] ]], xpath.parse(s, astFactory)); }); specify("testParseAbsoluteLocationPath", function() { var s = new xpath.Stream('/a/b/c'); assert.deepEqual( ['PathExpr', [ '/', [ '/', [ '/', [ 'Root' ], ['Axis', 'child', 'element', 'a' ] ], [ 'Axis', 'child', 'element', 'b' ] ], [ 'Axis', 'child', 'element', 'c' ] ] ], xpath.parse(s, astFactory)); }); specify("testParseRelativeLocationPath", function() { var s = new xpath.Stream('a/b/c'); assert.deepEqual( ['PathExpr', [ '/', [ '/', [ 'Axis', 'child', 'element', 'a' ], [ 'Axis', 'child', 'element', 'b' ] ], [ 'Axis', 'child', 'element', 'c' ] ] ], xpath.parse(s, astFactory)); }); specify("testParseNodeTest", function() { var s = new xpath.Stream('self::node()'); assert.deepEqual(['PathExpr', ['Axis', 'self', 'node', undefined]], xpath.parse(s, astFactory)); }); specify("testParseAbsoluteShorthand", function() { var s2 = new xpath.Stream('/descendant-or-self::node()/a'); var s1 = new xpath.Stream('//a'); assert.deepEqual(xpath.parse(s2, astFactory), xpath.parse(s1, astFactory)); }); specify("testParseLocationShorthand", function() { var s1 = new xpath.Stream('a//b'); var s2 = new xpath.Stream('a/descendant-or-self::node()/b'); assert.deepEqual(xpath.parse(s2, astFactory), xpath.parse(s1, astFactory)); }); specify("testParseRoot", function() { var s = new xpath.Stream('/'); assert.deepEqual(['PathExpr', ['Root']], xpath.parse(s, astFactory)); }); specify("testEvaluateNumber", function() { var x = xpath.evaluate('3', null, 'CTX'); assert.deepEqual(3, x); }); specify("testEvaluateExtraParens", function() { var x = xpath.evaluate('(((3)))', null, 'CTX'); assert.deepEqual(3, x); }); specify("testEvaluateNumberFunction", function() { var x = xpath.evaluate('number("3")', null, 'CTX'); assert.equal(3, x); }); specify("testEvaluateUnaryMinus", function() { var x = xpath.evaluate('-3', null, 'CTX'); assert.deepEqual(-3, x); }); specify("testEvaluateUnaryMinusCoerced", function() { var x = xpath.evaluate('--"3"', null, 'CTX'); assert.deepEqual(3, x); }); specify("testEvaluateArithmetic", function() { var x = xpath.evaluate('(2*11 + 5)mod 10', null, 'CTX'); assert.deepEqual(7, x); }); specify("testEvaluateArithmetic2", function() { var x = xpath.evaluate( '1>.5 and 1>=.5 and (2=6div 3) and false()<.5 and true()>.5', null, 'CTX'); assert.deepEqual(true, x); }); specify("testEvaluateWildcardChild", function() { const doc = (new JSDOM('
      3
      4
      ')).window.document, body = doc.getElementsByTagName('body')[0], div0 = doc.getElementsByTagName('div')[0], div1 = doc.getElementsByTagName('div')[1]; var x = xpath.evaluate('*', doc, body); assert.deepEqual(xpath.stringifyObject({nodes:[div0,div1], pos: [[1],[2]], lasts: [[2],[2]]}), xpath.stringifyObject(x)); }); specify("testEvaluateArithmetic3", function() { const doc = (new JSDOM('
      3
      4
      ')).window.document, body = doc.getElementsByTagName('body')[0]; var x = xpath.evaluate( '*<*', doc, body); assert.deepEqual(true, x); }); specify("testEvaluateSelf", function() { const doc = (new JSDOM('
      a
      b
      ')).window.document, div0 = doc.getElementsByTagName('div')[0], div1 = doc.getElementsByTagName('div')[1]; var newCtx = xpath.axes.self([doc, div0, div1], xpath.nodeTypes.element, null, true); assert.deepEqual( xpath.stringifyObject( {nodes: [div0, div1], pos: [[1], [1]], lasts: [[1],[1]]}), xpath.stringifyObject(newCtx)); }); specify("testEvaluateParent", function() { const doc = (new JSDOM('
      a
      b
      ')).window.document, div0 = doc.getElementsByTagName('div')[0], span = doc.getElementsByTagName('span')[0], body = div0.parentNode; var newCtx = xpath.axes.parent([doc, div0, span], xpath.nodeTypes.element, null, true); assert.deepEqual( xpath.stringifyObject( {nodes: [body], pos: [[1]], lasts: [[1]]}), xpath.stringifyObject(newCtx)); }); specify("testSortUniqDocumentOrder", function() { const doc = (new JSDOM('
      b
      ')).window.document, body = doc.getElementsByTagName('body')[0], div0 = doc.getElementsByTagName('div')[0], id = doc.getElementById('x').getAttributeNode('id'), a = doc.getElementsByTagName('a')[0], span = doc.getElementsByTagName('span')[0]; var ctx = {nodes: [id, body, span, div0, a, span]}; var ctx2 = {nodes: xpath.sortUniqDocumentOrder(ctx.nodes)}; assert.deepEqual( xpath.stringifyObject( {nodes: [body, div0, id, a, span]}), xpath.stringifyObject(ctx2)); }); specify("testId", function() { const doc = (new JSDOM('
      b c d



      ')).window.document, b = doc.getElementById('b'), c = doc.getElementById('c'), d = doc.getElementById('d'); assert.deepEqual( xpath.stringifyObject( {nodes: [b,c,d]}), xpath.stringifyObject( xpath.evaluate('id(id("test"))', doc, doc))); }); function outerHtml(node) { return node.outerHTML; } specify("testEvaluateChildAxis", function() { const doc = (new JSDOM('Hello.')).window.document; var ctx = doc.body; var x = xpath.evaluate('child::text()', doc, ctx); assert.deepEqual([doc.body.firstChild], x.nodes); }); specify("testDescendantDfs1", function() { const doc = (new JSDOM('')).window.document; var body = doc.getElementsByTagName('body')[0], a = doc.getElementsByTagName('a')[0], b = doc.getElementsByTagName('b')[0], i = doc.getElementsByTagName('i')[0], u = doc.getElementsByTagName('u')[0]; var newCtx = xpath.axes.descendant([body], xpath.nodeTypes.element, null, true).simplify(); assert.deepEqual( xpath.stringifyObject( {nodes: [a, b, i, u], pos:[[1],[2],[3],[4]],lasts:[[4],[4],[4],[4]]}), xpath.stringifyObject(newCtx)); }); specify("testDescendantOrSelfChild", function() { // from http://trac.webkit.org/export/73247/trunk/LayoutTests/fast/xpath/xpath-functional-test.html var doc = (new JSDOM( '' + '
      ' + ' ' + ' blockquoteText1:' + '
      ' + ' blockquoteText2' + '

      ' + ' del' + ' ins' + '

      ' + ' ' + ' font' + '
      ' + '' )).window.document; var newCtx = xpath.evaluate('.//*[ancestor::blockquote]', doc, doc); var nodeNames = newCtx.nodes .map(function(n) {return n.nodeName;}) .join(' ').toLowerCase(); assert.deepEqual('br p del ins font', nodeNames); }); function testDescendantDfsAndSelfBase(test, andSelf) { var andSelf = !!andSelf; const doc = (new JSDOM('
      a
      b
      ')).window.document; var div0 = doc.getElementsByTagName('div')[0], div1 = doc.getElementsByTagName('div')[1]; if (andSelf) fn = xpath.axes['descendant-or-self']; else fn = xpath.axes.descendant; var newCtx = fn([div0], xpath.nodeTypes.element, 'div', true).simplify(); var expectedNodes = andSelf ? [div0, div1] : [div1]; var expectedPos = andSelf ? [[1], [2]] : [[1]]; var expectedLasts = andSelf ? [[2], [2]] : [[1]]; assert.deepEqual( xpath.stringifyObject( {nodes: expectedNodes, pos: expectedPos, lasts: expectedLasts}), xpath.stringifyObject(newCtx)); }; specify("testDescendantDfs", function(t) { testDescendantDfsAndSelfBase(t, false); }); specify("testDescendantDfsAndSelf", function(t) { testDescendantDfsAndSelfBase(t, true); }); specify("testFollowing", function() { var doc = (new JSDOM( '' + '' + '
      ' + '
      ' + '')).window.document; var body = doc.getElementsByTagName('body')[0], div0 = doc.getElementsByTagName('div')[0], a = doc.getElementsByTagName('a')[0], b = doc.getElementsByTagName('b')[0], div1 = doc.getElementsByTagName('div')[1], i = doc.getElementsByTagName('i')[0], u = doc.getElementsByTagName('u')[0]; var newCtx = xpath.axes.following([body, div0, a], xpath.nodeTypes.element, null, true).simplify(); assert.deepEqual( xpath.stringifyObject( { nodes: [ b, div1, i, u ], pos: [ [ 1 ], [ 2, 1 ], [ 3, 2 ], [ 4, 3 ] ], lasts: [ [ 4 ], [ 4, 3 ], [ 4, 3 ], [ 4, 3 ] ] }), xpath.stringifyObject(newCtx)); }); specify("testPreceding2", function() { var doc = (new JSDOM( '' + '' + '
      ' + '
      ' + '')).window.document; var head = doc.getElementsByTagName('head')[0], title = doc.getElementsByTagName('title')[0], a = doc.getElementsByTagName('a')[0], b = doc.getElementsByTagName('b')[0], i = doc.getElementsByTagName('i')[0], u = doc.getElementsByTagName('u')[0], div0 = doc.getElementsByTagName('div')[0], div1 = doc.getElementsByTagName('div')[1]; var newCtx = xpath.axes.preceding([b, i], xpath.nodeTypes.element, null, true); assert.deepEqual( xpath.stringifyObject( {nodes: [head, title, div0, a, b], pos: [ [ 5, 3 ], [ 4, 2 ], [ 3 ], [ 2, 1 ], [ 1 ] ], lasts: [[5, 3], [5, 3], [5], [5, 3], [5]]}), xpath.stringifyObject(newCtx)); }); specify("testFollowingSibling", function() { const doc = (new JSDOM('onetwothreefourfivesix')).window.document; var one = doc.getElementsByTagName('a')[0], two = doc.getElementsByTagName('a')[1], three = doc.getElementsByTagName('a')[2], four = doc.getElementsByTagName('a')[3], five = doc.getElementsByTagName('a')[4], six = doc.getElementsByTagName('a')[5]; var newCtx = xpath.evaluate('a[3]/following-sibling::*', doc, doc.body); assert.deepEqual( xpath.stringifyObject({nodes:[four,five,six]}), xpath.stringifyObject(newCtx)); }); specify("testPrecedingSibling", function() { const doc = (new JSDOM('onetwothreefourfivesix')).window.document; var one = doc.getElementsByTagName('a')[0], two = doc.getElementsByTagName('a')[1], three = doc.getElementsByTagName('a')[2], four = doc.getElementsByTagName('a')[3], five = doc.getElementsByTagName('a')[4], six = doc.getElementsByTagName('a')[5]; var newCtx = xpath.evaluate('a[3]/preceding-sibling::*', doc, doc.body); assert.deepEqual( xpath.stringifyObject({nodes:[one,two]}), xpath.stringifyObject(newCtx)); }); specify("testAncestor", function() { const doc = (new JSDOM('
      a
      b
      ')).window.document; var html = doc.getElementsByTagName('html')[0], body = doc.getElementsByTagName('body')[0], div0 = doc.getElementsByTagName('div')[0], div1 = doc.getElementsByTagName('div')[1], img = doc.getElementsByTagName('img')[0]; var newCtx = xpath.axes.ancestor([div1, img], xpath.nodeTypes.element, null, true); assert.deepEqual( xpath.stringifyObject( {nodes: [html, body, div0], pos: [ [ 3, 2 ], [ 2, 1 ], [ 1 ] ], lasts: [ [ 3, 2 ], [ 3, 2 ], [ 3 ] ]}), xpath.stringifyObject(newCtx)); }); specify("testChild", function() { const doc = (new JSDOM('
      a
      b
      ')).window.document; var html = doc.getElementsByTagName('html')[0], body = doc.getElementsByTagName('body')[0], div0 = doc.getElementsByTagName('div')[0], div1 = doc.getElementsByTagName('div')[1], img = doc.getElementsByTagName('img')[0]; var newCtx = xpath.axes.child([body], xpath.nodeTypes.element, null, true); assert.deepEqual( xpath.stringifyObject( {nodes: [div0, img], pos: [[1], [2]], lasts: [[2],[2]] }), xpath.stringifyObject(newCtx)); }) // TODO: 'concat(a[1], a[1][1])' // TODO: 'concat(a[1], a[position()>1][1])' specify("testEvaluatePosition", function() { const doc = (new JSDOM('onetwothree')).window.document; var x = xpath.evaluate('concat(a[1], a[1][1])', doc, doc.body); assert.deepEqual('oneone', x); }); specify("testEvaluatePositionAndLast", function() { const doc = (new JSDOM('onetwothreefourfivesix')).window.document; var one = doc.getElementsByTagName('a')[0], two = doc.getElementsByTagName('a')[1], three = doc.getElementsByTagName('a')[2], four = doc.getElementsByTagName('a')[3], five = doc.getElementsByTagName('a')[4], six = doc.getElementsByTagName('a')[5]; var newCtx = xpath.evaluate('//a[last() mod position()=0]', doc, doc.body); assert.deepEqual( xpath.stringifyObject({nodes:[one,two,three,six]}), xpath.stringifyObject(newCtx)); }); specify("testAttributePredicate", function() { const doc = (new JSDOM('a')).window.document; var a = doc.getElementsByTagName('a')[0]; var newCtx = xpath.evaluate('//*[@href="x"]', doc, doc.body); assert.deepEqual( xpath.stringifyObject({nodes:[a]}), xpath.stringifyObject(newCtx)); }); specify("testMorePredicates", function() { const doc = (new JSDOM('
      ')).window.document; var blockquote = doc.getElementsByTagName('blockquote')[0], a = doc.getElementsByTagName('a')[0]; var newCtx = xpath.evaluate('//*[ancestor::blockquote]', doc, doc.body); assert.deepEqual( xpath.stringifyObject({nodes:[a]}), xpath.stringifyObject(newCtx)); }); specify("testAttributeWildcard", function() { const doc = (new JSDOM('a')).window.document; var a = doc.getElementsByTagName('a')[0]; var newCtx = xpath.evaluate('//*[@*="alternate"]', doc, doc.body); assert.deepEqual( xpath.stringifyObject({nodes:[a]}), xpath.stringifyObject(newCtx)); }); specify("testEvaluatePath", function() { const doc = (new JSDOM('
      a
      b
      ')).window.document; var html = doc.getElementsByTagName('html')[0], body = doc.getElementsByTagName('body')[0], div0 = doc.getElementsByTagName('div')[0], div1 = doc.getElementsByTagName('div')[1], img = doc.getElementsByTagName('img')[0]; var newCtx = xpath.evaluate('div/div', doc, doc.body); assert.deepEqual( xpath.stringifyObject( {nodes: [div1], pos: [[1]], lasts: [[1]]}), xpath.stringifyObject(newCtx)); }); specify("testEvaluateSubstringBefore", function() { const doc = (new JSDOM('')).window.document; var newCtx = xpath.evaluate('substring-before("1999/04/01","/")', doc, doc.body); assert.equal('1999', newCtx); }); specify("testEvaluateSubstringAfter", function() { const doc = (new JSDOM('')).window.document; var newCtx = xpath.evaluate('substring-after("1999/04/01","/")', doc, doc.body); assert.deepEqual('04/01', newCtx); }); specify("testEvaluateSubstring", function() { const doc = (new JSDOM('')).window.document; assert.equal('04', xpath.evaluate('substring("1999/04/01", 6, 2)', doc, doc)); assert.equal('04/01', xpath.evaluate('substring("1999/04/01", 6)', doc, doc)); }); specify("testEvaluateContains", function() { const doc = (new JSDOM('')).window.document; assert.equal(true, xpath.evaluate('contains("hello", "el")', doc, doc)); assert.equal(false, xpath.evaluate('contains("hello", "mm")', doc, doc)); }); specify("testEvaluateTranslate", function() { const doc = (new JSDOM('')).window.document; assert.equal('BAr', xpath.evaluate('translate("bar","abc","ABC")', doc, doc)); assert.equal('AAA', xpath.evaluate('translate("--aaa--", "abc-", "ABC")', doc, doc)); assert.equal('sub', xpath.evaluate('translate(normalize-space(" s u b"), " ", "")', doc, doc)); }); specify("testUnion", function() { const doc = (new JSDOM('
      a
      b
      ')).window.document; var html = doc.getElementsByTagName('html')[0], body = doc.getElementsByTagName('body')[0], div0 = doc.getElementsByTagName('div')[0], div1 = doc.getElementsByTagName('div')[1], img = doc.getElementsByTagName('img')[0]; var newCtx = xpath.evaluate('img|div/div', doc, doc.body); assert.deepEqual( xpath.stringifyObject( {nodes: [div1, img]}), xpath.stringifyObject(newCtx)); }); specify("testUnion2", function() { const doc = (new JSDOM('
      a
      b
      ')).window.document; var html = doc.getElementsByTagName('html')[0], body = doc.getElementsByTagName('body')[0], div0 = doc.getElementsByTagName('div')[0], div1 = doc.getElementsByTagName('div')[1], img = doc.getElementsByTagName('img')[0]; var newCtx = xpath.evaluate('div|zz', doc, doc.body); assert.deepEqual( xpath.stringifyObject( {nodes: [div0]}), xpath.stringifyObject(newCtx)); }); specify("testUnion3", function() { const doc = (new JSDOM('
      a
      b
      ')).window.document; var html = doc.getElementsByTagName('html')[0], body = doc.getElementsByTagName('body')[0], div0 = doc.getElementsByTagName('div')[0], div1 = doc.getElementsByTagName('div')[1], img = doc.getElementsByTagName('img')[0]; var newCtx = xpath.evaluate('zz|div', doc, doc.body); assert.deepEqual( xpath.stringifyObject( {nodes: [div0]}), xpath.stringifyObject(newCtx)); }); function stringifyNodeList(l) { var r = []; for (var i = 0; i < l.length; ++i) { r.push(l[i].outerHTML); } return r; } specify("testDocumentEvaluate", function() { const doc = (new JSDOM('
      a
      b
      ')).window.document; var html = doc.getElementsByTagName('html')[0], body = doc.getElementsByTagName('body')[0], div0 = doc.getElementsByTagName('div')[0], div1 = doc.getElementsByTagName('div')[1], img = doc.getElementsByTagName('img')[0]; var res = doc.evaluate('img', doc.body, null, 0, null); var r = [], x; while (x = res.iterateNext()) r.push(x); assert.deepEqual( stringifyNodeList([img]), stringifyNodeList(r)); }); specify("testDocumentEvaluate2", function() { const doc = (new JSDOM('
      a
      b
      ')).window.document; var html = doc.getElementsByTagName('html')[0], body = doc.getElementsByTagName('body')[0], div0 = doc.getElementsByTagName('div')[0], div1 = doc.getElementsByTagName('div')[1], img = doc.getElementsByTagName('img')[0]; var res = doc.evaluate('//div', doc, null, 0, null); var r = [], x; while (x = res.iterateNext()) r.push(x); assert.deepEqual( stringifyNodeList([div0, div1]), stringifyNodeList(r)); }); specify("testDocumentEvaluateWildcard", function() { const doc = (new JSDOM('
      a
      b
      ')).window.document; var html = doc.getElementsByTagName('html')[0], body = doc.getElementsByTagName('body')[0], div0 = doc.getElementsByTagName('div')[0], div1 = doc.getElementsByTagName('div')[1], img = doc.getElementsByTagName('img')[0]; var res = doc.evaluate('//div/*', doc, null, 0, null); var r = [], x; while (x = res.iterateNext()) r.push(x); assert.deepEqual( stringifyNodeList([div1]), stringifyNodeList(r)); }); specify("testDocumentEvaluateStringPred", function() { const doc = (new JSDOM('
      a
      b
      ')).window.document; var html = doc.getElementsByTagName('html')[0], body = doc.getElementsByTagName('body')[0], div0 = doc.getElementsByTagName('div')[0], div1 = doc.getElementsByTagName('div')[1], img = doc.getElementsByTagName('img')[0]; var res = doc.evaluate('//div[1]', doc, null, 0, null); var r = [], x; while (x = res.iterateNext()) r.push(x); assert.deepEqual( stringifyNodeList([div0, div1]), stringifyNodeList(r)); }); specify("testAttributeNodePredicate", function() { // copied from Webkit LayoutTests/fast/xpath/attribute-node-predicate.html const doc = (new JSDOM('')).window.document; var root = doc.createElement('div'); root.innerHTML = '

      a

      '; var child1 = root.firstChild, child1text = child1.firstChild, child2 = root.lastChild, child21 = child2.firstChild, child22 = child21.nextSibling, child23 = child22.nextSibling; var result = xpath.evaluate(".//@id[false]", doc, root); assert.deepEqual(xpath.stringifyObject({nodes:[]}), xpath.stringifyObject(result)); result = xpath.evaluate(".//@id[1]/parent::*", doc, root); assert.deepEqual( xpath.stringifyObject({nodes:[child21, child22, child23], pos: [ [ 1 ], [ 1 ], [ 1 ] ], lasts: [ [ 1 ], [ 1 ], [ 1 ] ]}), xpath.stringifyObject(result)); result = xpath.evaluate(".//@id[2]/parent::*", doc, root); assert.deepEqual(xpath.stringifyObject({nodes:[],pos:[],lasts:[]}), xpath.stringifyObject(result)); result = xpath.evaluate(".//@id[string()='21']/parent::*", doc, root); assert.deepEqual( xpath.stringifyObject({nodes:[child21], pos:[[1]],lasts:[[1]]}), xpath.stringifyObject(result)); result = xpath.evaluate(".//@id[string()='22']/parent::*", doc, root); assert.deepEqual( xpath.stringifyObject({nodes:[child22], pos:[[1]],lasts:[[1]]}), xpath.stringifyObject(result)); }); // The following test cases are taken from the NIST XSLT/XPath test suite. // http://web.archive.org/web/20041019015748/http://xw2k.sdct.itl.nist.gov/xml/page5.html // Only test cases applicable to XPath are included. specify("NIST_coreFunction001", function() { const document = (new JSDOM("", { contentType: "application/xml" })).window.document; assert.equal("correct substring", xpath.evaluate("substring(substring('internalexternalcorrect substring',9),9)", document, document), "correct substring"); }); specify("NIST_coreFunction002", function() { const document = (new JSDOM("", { contentType: "application/xml" })).window.document; assert.equal("correct substring", xpath.evaluate("substring(substring('internalexternalcorrect substring',9,25),9,17)", document, document), "correct substring"); }); specify("NIST_coreFunction003", function() { const document = (new JSDOM("", { contentType: "application/xml" })).window.document; assert.equal("A New Concatenated String", xpath.evaluate("concat(concat('A ','N','e'),'w ','Concatenated String')", document, document)); }); specify("NIST_coreFunction004", function() { const document = (new JSDOM("", { contentType: "application/xml" })).window.document; assert.equal("Unchanged String", xpath.evaluate("string(string('Unchanged String'))", document, document)); }); specify("NIST_coreFunction005", function() { const document = (new JSDOM("", { contentType: "application/xml" })).window.document; assert.equal("Correct Substring After", xpath.evaluate("substring-after(substring-after('wrongnogoodCorrect Substring After','wrong'),'nogood')", document, document)); }); specify("NIST_coreFunction006", function() { const document = (new JSDOM("", { contentType: "application/xml" })).window.document; assert.equal("correct substring Before", xpath.evaluate("substring-before(substring-before('correct substring Beforenogoodwrong','wrong'),'nogood')", document, document)); }); specify("NIST_coreFunction007", function() { const document = (new JSDOM("", { contentType: "application/xml" })).window.document; assert.equal("new string", xpath.evaluate("translate(translate('old string','old','123'),'123','new')", document, document)); }); specify("NIST_coreFunction008", function() { const document = (new JSDOM("", { contentType: "application/xml" })).window.document; assert.equal("new string", xpath.evaluate("translate('old string',translate('123','123','old'),'new')", document, document)); }); specify("NIST_coreFunction009", function() { const document = (new JSDOM("", { contentType: "application/xml" })).window.document; assert.equal("new string", xpath.evaluate("translate(translate('old string','old string','old string'),translate('123','123','old'),translate('123','123','new'))", document, document)); }); specify("NIST_coreFunction010", function() { const document = (new JSDOM("", { contentType: "application/xml" })).window.document; assert.equal("new string", xpath.evaluate("translate(translate('old string','old string','old string'),translate('123','123','old'),translate('123','123','new'))", document, document)); }); specify("NIST_coreFunction011", function() { const document = (new JSDOM("", { contentType: "application/xml" })).window.document; assert.equal("A New Concatenated String", xpath.evaluate("concat('A New ',concat('Conca','tena','ted '),'String')", document, document)); }); specify("NIST_coreFunction012", function() { const document = (new JSDOM("", { contentType: "application/xml" })).window.document; assert.equal("A New Concatenated String", xpath.evaluate("concat('A New ','Concatenated ',concat('St','ri','ng'))", document, document)); }); specify("NIST_coreFunction013", function() { const document = (new JSDOM("", { contentType: "application/xml" })).window.document; assert.equal("A New Concatenated String", xpath.evaluate("concat(concat('A ','Ne','w '),concat('Conca','tena','ted '),concat('St','ri','ng'))", document, document)); }); specify("NIST_coreFunction014", function() { const document = (new JSDOM("", { contentType: "application/xml" })).window.document; assert.equal("Correct Substring After", xpath.evaluate("substring-after('wrongCorrect Substring After',substring-after('nogoodstringwrong','nogoodstring'))", document, document)); }); specify("NIST_coreFunction015", function() { const document = (new JSDOM("", { contentType: "application/xml" })).window.document; assert.equal("Correct Substring After", xpath.evaluate("substring-after(substring-after('nogoodwrongCorrect Substring After','nogood'),substring-after('nogoodstringwrong','nogoodstring'))", document, document)); }); specify("NIST_coreFunction016", function() { const document = (new JSDOM("", { contentType: "application/xml" })).window.document; assert.equal("Correct Substring Before", xpath.evaluate("substring-before('Correct Substring Beforewrong',substring-before('wrongnogood','nogood'))", document, document)); }); specify("NIST_coreFunction017", function() { const document = (new JSDOM("", { contentType: "application/xml" })).window.document; assert.equal("Correct Substring Before", xpath.evaluate("substring-before(substring-before('Correct Substring Beforewrongcut here','cut here'),substring-before('wrongnogood','nogood'))", document, document)); }); // coreFunction018 thru coreFunction035 are omitted because they test XPath // variables, but DOM 3 XPath does not provide any facility to set variables. // // The tests are reproduced here anyway in case in the future jsdom provides // some non-standard mechanism for setting variables. // // // exports.NIST_coreFunction018 = function(test) { // const document = (new JSDOM("", { contentType: "application/xml" })).window.document; // // set $variable1 = "String From Variable" // test.equal("String From Variable", // xpath.evaluate("string($variable1)", document, document)); // }; // // exports.NIST_coreFunction019 = function(test) { // const document = (new JSDOM("", { contentType: "application/xml" })).window.document; // // set $variable1 = "String " // test.equal("String From Variable", // xpath.evaluate("concat($variable1,'From ','Variable')", document, document)); // }; // // exports.NIST_coreFunction020 = function(test) { // const document = (new JSDOM("", { contentType: "application/xml" })).window.document; // // set $variable1 = "From " // test.equal("String From Variable", // xpath.evaluate("concat('String ',$variable1,'Variable')", document, document)); // }; // // exports.NIST_coreFunction021 = function(test) { // const document = (new JSDOM("", { contentType: "application/xml" })).window.document; // // set $variable1 = "Variable" // test.equal("String From Variable", // xpath.evaluate("concat('String ','From ',$variable1)", document, document)); // }; // // exports.NIST_coreFunction022 = function(test) { // const document = (new JSDOM("", { contentType: "application/xml" })).window.document; // // set $variable1 = "String " // // set $variable2 = "From " // // set $variable3 = "Variable" // test.equal("String From Variable", // xpath.evaluate("concat($variable1,$variable2,$variable3)", document, document)); // }; // // exports.NIST_coreFunction023 = function(test) { // const document = (new JSDOM("", { contentType: "application/xml" })).window.document; // // set $variable1 = "substring-before with variablecut this" // test.equal("substring-before with variable", // xpath.evaluate("substring-before($variable1,'cut this')", document, document)); // }; // // exports.NIST_coreFunction024 = function(test) { // const document = (new JSDOM("", { contentType: "application/xml" })).window.document; // // set $variable1 = "cut this" // test.equal("substring-before with variable", // xpath.evaluate("substring-before('substring-before with variablecut this',$variable1)", document, document)); // }; // // exports.NIST_coreFunction025 = function(test) { // const document = (new JSDOM("", { contentType: "application/xml" })).window.document; // // set $variable1 = "substring before with variablecut this" // // set $variable2 = "cut this" // test.equal("substring before with variable", // xpath.evaluate("substring-before($variable1,$variable2)", document, document)); // }; // // exports.NIST_coreFunction026 = function(test) { // const document = (new JSDOM("", { contentType: "application/xml" })).window.document; // // set $variable1 = "cut thissubstring-after with variable" // test.equal("substring-after with variable", // xpath.evaluate("substring-after($variable1,'cut this')", document, document)); // }; // // exports.NIST_coreFunction027 = function(test) { // const document = (new JSDOM("", { contentType: "application/xml" })).window.document; // // set $variable1 = "cut this" // test.equal("substring after with variable", // xpath.evaluate("substring-after('cut thissubstring after with variable',$variable1)", document, document)); // }; // // exports.NIST_coreFunction028 = function(test) { // const document = (new JSDOM("", { contentType: "application/xml" })).window.document; // // set $variable1 = "cut thissubstring-after with variable" // // set $variable2 = "cut this" // test.equal("substring-after with variable", // xpath.evaluate("substring-after($variable1,$variable2)", document, document)); // }; // // exports.NIST_coreFunction029 = function(test) { // const document = (new JSDOM("", { contentType: "application/xml" })).window.document; // // set $variable1 = "cut thissubstring with variable" // test.equal("substring with variable", // xpath.evaluate("substring($variable1,9)", document, document)); // }; // // exports.NIST_coreFunction030 = function(test) { // const document = (new JSDOM("", { contentType: "application/xml" })).window.document; // // set $variable1 = "cut thissubstring with variable" // test.equal("substring with variable", // xpath.evaluate("substring($variable1,9,23)", document, document)); // }; // // exports.NIST_coreFunction031 = function(test) { // const document = (new JSDOM("", { contentType: "application/xml" })).window.document; // // set $variable1 = "should return the value 26" // test.equal(26, // xpath.evaluate("string-length($variable1)", document, document)); // }; // // exports.NIST_coreFunction032 = function(test) { // const document = (new JSDOM("", { contentType: "application/xml" })).window.document; // // set $variable1 = "translate 1234 variable" // test.equal("translate with variable", // xpath.evaluate("translate($variable1,'1234','with')", document, document)); // }; // // exports.NIST_coreFunction033 = function(test) { // const document = (new JSDOM("", { contentType: "application/xml" })).window.document; // // set $variable1 = "1234" // test.equal("translate with variable", // xpath.evaluate("translate('translate 1234 variable',$variable1,'with')", document, document)); // }; // // exports.NIST_coreFunction034 = function(test) { // const document = (new JSDOM("", { contentType: "application/xml" })).window.document; // // set $variable1 = "with" // test.equal("translate with variable", // xpath.evaluate("translate('translate 1234 variable','1234',$variable1)", document, document)); // }; // // exports.NIST_coreFunction035 = function(test) { // const document = (new JSDOM("", { contentType: "application/xml" })).window.document; // // set $variable1 = "translate 1234 variable" // // set $variable2 = "1234" // // set $variable3 = "with" // test.equal("translate with variable", // xpath.evaluate("translate($variable1,$variable2,$variable3)", document, document)); // }; // coreFunction036 thru coreFunction059 are omitted since they test XSLT // parameters. Outside the context of XSLT, they are effectively redundant // with coreFunction018 thru coreFunction035. specify("NIST_coreFunction060", function() { const document = (new JSDOM("", { contentType: "application/xml" })).window.document; assert.equal(-2, xpath.evaluate("floor(-1.99999)", document, document)); }); specify("NIST_coreFunction061", function() { const document = (new JSDOM("", { contentType: "application/xml" })).window.document; assert.equal(-2, xpath.evaluate("floor(-1.0001)", document, document)); }); // coreFunction062 is omitted because it tests XPath variables, as above. // exports.NIST_coreFunction062 = function(test) { // const document = (new JSDOM("", { contentType: "application/xml" })).window.document; // // set $variable1 = "3.1" // test.equal(3, // xpath.evaluate("floor($variable1)", document, document)); // }; // coreFunction063 is omitted because it tests XSLT parameters, as above. specify("NIST_coreFunction064", function() { const document = (new JSDOM("", { contentType: "application/xml" })).window.document; assert.equal(2, xpath.evaluate("floor(ceiling(1.2))", document, document)); }); specify("NIST_coreFunction065", function() { const document = (new JSDOM("", { contentType: "application/xml" })).window.document; assert.equal(1, xpath.evaluate("floor(round(1.2))", document, document)); }); specify("NIST_coreFunction066", function() { const document = (new JSDOM("", { contentType: "application/xml" })).window.document; assert.equal(1, xpath.evaluate("floor(floor(1.2))", document, document)); }); specify("NIST_coreFunction067", function() { const document = (new JSDOM("", { contentType: "application/xml" })).window.document; assert.equal(1, xpath.evaluate("floor((((((2*10)-4)+9) div 5) mod 2))", document, document)); }); specify("NIST_coreFunction068", function() { const document = (new JSDOM("", { contentType: "application/xml" })).window.document; assert.equal(-1, xpath.evaluate("ceiling(-1.0001)", document, document)); }); specify("NIST_coreFunction069", function() { const document = (new JSDOM("", { contentType: "application/xml" })).window.document; assert.equal(-1, xpath.evaluate("ceiling(-1.9999)", document, document)); }); // coreFunction070 is omitted because it tests XPath variables, as above. // // exports.NIST_coreFunction070 = function(test) { // const document = (new JSDOM("", { contentType: "application/xml" })).window.document; // // set $variable1 = "2.5" // test.equal(3, // xpath.evaluate("ceiling($variable1)", document, document)); // }; specify("NIST_coreFunction071", function() { const document = (new JSDOM("", { contentType: "application/xml" })).window.document; assert.equal(2, xpath.evaluate("ceiling(floor(2.2))", document, document)); }); specify("NIST_coreFunction072", function() { const document = (new JSDOM("", { contentType: "application/xml" })).window.document; assert.equal(4, xpath.evaluate("ceiling(ceiling(3.2))", document, document)); }); // coreFunction073 is omitted because it tests XSLT parameters, as above. specify("NIST_coreFunction074", function() { const document = (new JSDOM("", { contentType: "application/xml" })).window.document; assert.equal(3, xpath.evaluate("ceiling((((((2*10)-4)+9) div 5) div 2))", document, document)); }); specify("NIST_coreFunction075", function() { const document = (new JSDOM("", { contentType: "application/xml" })).window.document; assert.equal(-2, xpath.evaluate("round(-1.9999)", document, document)); }); // coreFunction076 is omitted because it tests XPath variables, as above. // // exports.NIST_coreFunction076 = function(test) { // const document = (new JSDOM("", { contentType: "application/xml" })).window.document; // // set $variable1 = "2.3" // test.equal(2 // xpath.evaluate("round($variable1)", document, document)); // }; // coreFunction077 is omitted because it tests XSLT parameters, as above. specify("NIST_coreFunction078", function() { const document = (new JSDOM("", { contentType: "application/xml" })).window.document; assert.equal(4, xpath.evaluate("round(ceiling(3.2))", document, document)); }); specify("NIST_coreFunction079", function() { const document = (new JSDOM("", { contentType: "application/xml" })).window.document; assert.equal(3, xpath.evaluate("round((((((2*10)-4)+9) div 5) div 2))", document, document)); }); specify("NIST_coreFunction080", function() { const document = (new JSDOM("", { contentType: "application/xml" })).window.document; assert.ok(isNaN(xpath.evaluate("round(NaN)", document, document))); }); specify("NIST_coreFunction081", function() { const document = (new JSDOM("", { contentType: "application/xml" })).window.document; assert.equal(0, xpath.evaluate("round(-0)", document, document)); }); specify("NIST_coreFunction082", function() { const document = (new JSDOM("", { contentType: "application/xml" })).window.document; assert.equal(0, xpath.evaluate("round(-0.25)", document, document)); }); specify("NIST_coreFunction083", function() { const document = (new JSDOM("", { contentType: "application/xml" })).window.document; assert.equal(2, xpath.evaluate("round(round(2.3))", document, document)); }); specify("NIST_coreFunction084", function() { const document = (new JSDOM("", { contentType: "application/xml" })).window.document; assert.equal(Number.POSITIVE_INFINITY, xpath.evaluate("round(2.3 div 0)", document, document)); }); specify("NIST_coreFunction085", function() { const document = (new JSDOM("", { contentType: "application/xml" })).window.document; assert.equal(Number.NEGATIVE_INFINITY, xpath.evaluate("round(-2.3 div 0)", document, document)); }); specify("NIST_coreFunction086", function() { const document = (new JSDOM("", { contentType: "application/xml" })).window.document; assert.equal(-1.9999, xpath.evaluate("number('-1.9999')", document, document)); }); specify("NIST_coreFunction087", function() { const document = (new JSDOM("", { contentType: "application/xml" })).window.document; assert.equal(1.9999, xpath.evaluate("number('1.9999')", document, document)); }); specify("NIST_coreFunction088", function() { const document = (new JSDOM("", { contentType: "application/xml" })).window.document; var doc = document.documentElement; var element1 = document.createElement("element1"); doc.appendChild(element1); var child1 = document.createElement("child1"); element1.appendChild(child1); var text = document.createTextNode("Test executed Successfully!!"); child1.appendChild(text); var element2 = document.createElement("element2"); doc.appendChild(element2); child1 = document.createElement("child1"); text = document.createTextNode("Incorrect execution!!"); child1.appendChild(text); assert.equal(1, xpath.evaluate("count(//child1[ancestor::element1])", document, doc)); }); specify("NIST_coreFunction089", function() { const document = (new JSDOM("", { contentType: "application/xml" })).window.document; var doc = document.documentElement; var element1 = document.createElement("element1"); doc.appendChild(element1); var text = document.createTextNode("Incorrect Execution!!"); element1.appendChild(text); element1 = document.createElement("element1"); doc.appendChild(element1); text = document.createTextNode("Test executed Successfully!!"); element1.appendChild(text); domTestHelper.arrayEqual(assert, [element1], xpath.evaluate("element1[2]", document, doc).nodes); }); // Many of the NIST dataManipulation tests include more than one XPath query, // so here they're split into multiple test cases. // // Some dataManipulation tests test XSLT features that aren't part of XPath, // so those tests are omitted here. specify("NIST_dataManipulation001a", function() { const document = (new JSDOM("", { contentType: "application/xml" })).window.document; assert.equal(true, xpath.evaluate("2 > 1", document, document)); }); specify("NIST_dataManipulation001b", function() { const document = (new JSDOM("", { contentType: "application/xml" })).window.document; assert.equal(true, xpath.evaluate("9 mod 3 = 0", document, document)); }); specify("NIST_dataManipulation002a", function() { const document = (new JSDOM("", { contentType: "application/xml" })).window.document; assert.equal(false, xpath.evaluate("2 > 3", document, document)); }); specify("NIST_dataManipulation003", function() { const document = (new JSDOM("", { contentType: "application/xml" })).window.document; assert.equal(true, xpath.evaluate("(((((2*10)-4)+9) div 5) div 2) > 2", document, document)); }); specify("NIST_dataManipulation004", function() { const document = (new JSDOM("", { contentType: "application/xml" })).window.document; assert.equal(false, xpath.evaluate("(((((2*10)-4)+9) div 5) div 2) > 4", document, document)); }); specify("NIST_dataManipulation007", function() { const document = (new JSDOM("", { contentType: "application/xml" })).window.document; assert.equal(true, xpath.evaluate("(round(3.7) > 3)", document, document)); }); specify("NIST_dataManipulation009", function() { const document = (new JSDOM("", { contentType: "application/xml" })).window.document; var doc = document.documentElement; var element1 = document.createElement("element1"); doc.appendChild(element1); var text = document.createTextNode("Test executed successfully!!"); element1.appendChild(text); var element2 = document.createElement("element2"); text = document.createTextNode("Incorrect execution!!"); element2.appendChild(text); domTestHelper.arrayEqual(assert, [element1], xpath.evaluate("doc/element1", document, document).nodes); }); specify("NIST_dataManipulation013", function() { const document = (new JSDOM("", { contentType: "application/xml" })).window.document; var doc = document.documentElement; var element1 = document.createElement("element1"); doc.appendChild(element1); var text = document.createTextNode("Incorrect execution!!"); element1.appendChild(text); element1 = document.createElement("element1"); doc.appendChild(element1); text = document.createTextNode("Incorrect execution!!"); element1.appendChild(text); element1 = document.createElement("element1"); doc.appendChild(element1); text = document.createTextNode("Test Executed Successfully!!"); element1.appendChild(text); var element2 = document.createElement("element2"); doc.appendChild(element2); text = document.createTextNode("Incorrect execution!!"); element2.appendChild(text); domTestHelper.arrayEqual(assert, [element1], xpath.evaluate("doc/element1[last()]", document, document).nodes); }); specify("NIST_dataManipulation014", function() { const document = (new JSDOM("", { contentType: "application/xml" })).window.document; var doc = document.documentElement; var element1 = document.createElement("element1"); doc.appendChild(element1); var text = document.createTextNode("Incorrect execution!!"); element1.appendChild(text); element1 = document.createElement("element1"); doc.appendChild(element1); text = document.createTextNode("Incorrect execution!!"); element1.appendChild(text); element1 = document.createElement("element1"); doc.appendChild(element1); text = document.createTextNode("Test Executed Successfully!!"); element1.appendChild(text); var element2 = document.createElement("element2"); doc.appendChild(element2); text = document.createTextNode("Incorrect execution!!"); element2.appendChild(text); domTestHelper.arrayEqual(assert, [element1], xpath.evaluate("doc/element1[((((((2*10)-4)+9) div 5) mod 3)+1)]", document, document).nodes); }); specify("NIST_dataManipulation016", function() { const document = (new JSDOM("", { contentType: "application/xml" })).window.document; var doc = document.documentElement; var element1 = document.createElement("element1"); doc.appendChild(element1); var good_child1 = document.createElement("child1"); element1.appendChild(good_child1); var text = document.createTextNode("Test Executed Successfully!!"); good_child1.appendChild(text); var element2 = document.createElement("element2"); doc.appendChild(element2); child1 = document.createElement("child1"); element2.appendChild(child1); text = document.createTextNode("Incorrect Execution!!"); child1.appendChild(text); domTestHelper.arrayEqual(assert, [good_child1], xpath.evaluate("//child1[ancestor::element1]", document, document).nodes); }); specify("NIST_expression001", function() { const document = (new JSDOM("", { contentType: "application/xml" })).window.document; var doc = document.documentElement; var sub1 = document.createElement("sub1"); doc.appendChild(sub1); var child1 = document.createElement("child1"); sub1.appendChild(child1); var text = document.createTextNode("child1"); child1.appendChild(text); var sub2 = document.createElement("sub2"); doc.appendChild(sub2); var child2 = document.createElement("child2"); sub2.appendChild(child2); text = document.createTextNode("child2"); child2.appendChild(text); domTestHelper.arrayEqual(assert, [child1,child2], xpath.evaluate("/doc/sub1/child1|/doc/sub2/child2", document, doc).nodes); }); specify("NIST_expression002", function() { const document = (new JSDOM("", { contentType: "application/xml" })).window.document; var doc = document.documentElement; var sub1 = document.createElement("sub1"); doc.appendChild(sub1); var child1 = document.createElement("child1"); sub1.appendChild(child1); var text = document.createTextNode("child1"); child1.appendChild(text); var sub2 = document.createElement("sub2"); doc.appendChild(sub2); var child2 = document.createElement("child2"); sub2.appendChild(child2); text = document.createTextNode("child2"); child2.appendChild(text); domTestHelper.arrayEqual(assert, [child1,child2], xpath.evaluate("sub1/child1|/doc/sub2/child2", document, doc).nodes); }); specify("NIST_expression003", function() { const document = (new JSDOM("", { contentType: "application/xml" })).window.document; var doc = document.documentElement; var sub1 = document.createElement("sub1"); doc.appendChild(sub1); var child1 = document.createElement("child1"); sub1.appendChild(child1); var text = document.createTextNode("descendant number 1"); child1.appendChild(text); var sub2 = document.createElement("sub2"); doc.appendChild(sub2); var child2 = document.createElement("child2"); sub2.appendChild(child2); text = document.createTextNode("descendant number 2"); child2.appendChild(text); domTestHelper.arrayEqual(assert, [child1,child2], xpath.evaluate("//child1|//child2", document, doc).nodes); domTestHelper.arrayEqual(assert, [sub1], xpath.evaluate("ancestor::sub1|ancestor::sub2", document, child1).nodes); domTestHelper.arrayEqual(assert, [sub2], xpath.evaluate("ancestor::sub1|ancestor::sub2", document, child2).nodes); }); specify("NIST_expression004", function() { const document = (new JSDOM("", { contentType: "application/xml" })).window.document; var doc = document.documentElement; var sub1 = document.createElement("sub1"); doc.appendChild(sub1); var child1 = document.createElement("child1"); sub1.appendChild(child1); var text = document.createTextNode("descendant number 1"); child1.appendChild(text); var sub2 = document.createElement("sub2"); doc.appendChild(sub2); var child2 = document.createElement("child2"); sub2.appendChild(child2); text = document.createTextNode("descendant number 2"); child2.appendChild(text); domTestHelper.arrayEqual(assert, [child1,child2], xpath.evaluate("//child1|//child2", document, doc).nodes); domTestHelper.arrayEqual(assert, [sub1], xpath.evaluate("ancestor-or-self::sub1|ancestor-or-self::sub2", document, child1).nodes); domTestHelper.arrayEqual(assert, [sub2], xpath.evaluate("ancestor-or-self::sub1|ancestor-or-self::sub2", document, child2).nodes); }); specify("NIST_expression005", function() { const document = (new JSDOM("", { contentType: "application/xml" })).window.document; var doc = document.documentElement; var book1 = document.createElement("book"); doc.appendChild(book1); var author1 = document.createElement("author"); book1.appendChild(author1); var name = document.createElement("name"); author1.appendChild(name); name.setAttribute("real", "no"); var text = document.createTextNode("Carmelo Montanez"); name.appendChild(text); var chapters = document.createElement("chapters"); author1.appendChild(chapters); text = document.createTextNode("Nine"); chapters.appendChild(text); var bibliography = document.createElement("bibliography"); author1.appendChild(bibliography); var book2 = document.createElement("book"); doc.appendChild(book2); var author2 = document.createElement("author"); book2.appendChild(author2); name = document.createElement("name"); author2.appendChild(name); name.setAttribute("real", "na"); text = document.createTextNode("David Marston"); name.appendChild(text); chapters = document.createElement("chapters"); author2.appendChild(chapters); text = document.createTextNode("Seven"); chapters.appendChild(text); bibliography = document.createElement("bibliography"); author2.appendChild(bibliography); var book3 = document.createElement("book"); doc.appendChild(book3); var author3 = document.createElement("author"); book3.appendChild(author3); name = document.createElement("name"); author3.appendChild(name); name.setAttribute("real", "yes"); text = document.createTextNode("Mary Brady"); name.appendChild(text); chapters = document.createElement("chapters"); author3.appendChild(chapters); text = document.createTextNode("Ten"); bibliography = document.createElement("bibliography"); author3.appendChild(bibliography); domTestHelper.arrayEqual(assert, [author1], xpath.evaluate("author[name/@real='no']|author[name/@real='yes']", document, book1).nodes); domTestHelper.arrayEqual(assert, [], xpath.evaluate("author[name/@real='no']|author[name/@real='yes']", document, book2).nodes); domTestHelper.arrayEqual(assert, [author3], xpath.evaluate("author[name/@real='no']|author[name/@real='yes']", document, book3).nodes); }); specify("NIST_expression006", function() { const document = (new JSDOM("", { contentType: "application/xml" })).window.document; var doc = document.documentElement; doc.setAttribute("attr1", "attribute 1 "); doc.setAttribute("attr2", "attribute 2"); var sub1 = document.createElement("sub1"); doc.appendChild(sub1); var child1 = document.createElement("child1"); sub1.appendChild(child1); var text = document.createTextNode("child number 1"); child1.appendChild(text); var sub2 = document.createElement("sub2"); doc.appendChild(sub2); var child2 = document.createElement("child2"); text = document.createTextNode("child number 2"); child2.appendChild(text); domTestHelper.arrayEqual(assert, [doc.getAttributeNode("attr1"), doc.getAttributeNode("attr2")], xpath.evaluate("attribute::attr1|attribute::attr2", document, doc).nodes); }); specify("NIST_expression007", function() { const document = (new JSDOM("", { contentType: "application/xml" })).window.document; var doc = document.documentElement; doc.setAttribute("attr1", "attribute 1 "); doc.setAttribute("attr2", "attribute 2"); var sub1 = document.createElement("sub1"); doc.appendChild(sub1); var child1 = document.createElement("child1"); sub1.appendChild(child1); var text = document.createTextNode("child number 1"); child1.appendChild(text); var sub2 = document.createElement("sub2"); doc.appendChild(sub2); var child2 = document.createElement("child2"); text = document.createTextNode("child number 2"); child2.appendChild(text); domTestHelper.arrayEqual(assert, [sub1, sub2], xpath.evaluate("child::sub1|child::sub2", document, doc).nodes); }); specify("NIST_expression008", function() { const document = (new JSDOM("", { contentType: "application/xml" })).window.document; var doc = document.documentElement; var book1 = document.createElement("book"); doc.appendChild(book1); var author1 = document.createElement("author"); book1.appendChild(author1); var name = document.createElement("name"); author1.appendChild(name); name.setAttribute("real", "no"); var text = document.createTextNode("Carmelo Montanez"); name.appendChild(text); var chapters = document.createElement("chapters"); author1.appendChild(chapters); text = document.createTextNode("Nine"); chapters.appendChild(text); var bibliography = document.createElement("bibliography"); author1.appendChild(bibliography); var book2 = document.createElement("book"); doc.appendChild(book2); var author2 = document.createElement("author"); book2.appendChild(author2); name = document.createElement("name"); author2.appendChild(name); name.setAttribute("real", "na"); text = document.createTextNode("David Marston"); name.appendChild(text); chapters = document.createElement("chapters"); author2.appendChild(chapters); text = document.createTextNode("Seven"); chapters.appendChild(text); bibliography = document.createElement("bibliography"); author2.appendChild(bibliography); var book3 = document.createElement("book"); doc.appendChild(book3); var author3 = document.createElement("author"); book3.appendChild(author3); name = document.createElement("name"); author3.appendChild(name); name.setAttribute("real", "yes"); text = document.createTextNode("Mary Brady"); name.appendChild(text); chapters = document.createElement("chapters"); author3.appendChild(chapters); text = document.createTextNode("Ten"); bibliography = document.createElement("bibliography"); author3.appendChild(bibliography); domTestHelper.arrayEqual(assert, [author1], xpath.evaluate("author[(name/@real='no' and position()=1)]|author[(name/@real='yes' and position()=last())]", document, book1).nodes); domTestHelper.arrayEqual(assert, [], xpath.evaluate("author[(name/@real='no' and position()=1)]|author[(name/@real='yes' and position()=last())]", document, book2).nodes); domTestHelper.arrayEqual(assert, [author3], xpath.evaluate("author[(name/@real='no' and position()=1)]|author[(name/@real='yes' and position()=last())]", document, book3).nodes); }); specify("NIST_expression009", function() { const document = (new JSDOM("", { contentType: "application/xml" })).window.document; var doc = document.documentElement; var sub1 = document.createElement("sub1"); doc.appendChild(sub1); var child1 = document.createElement("child1"); sub1.appendChild(child1); var text = document.createTextNode("descendant number 1"); child1.appendChild(text); var sub2 = document.createElement("sub2"); doc.appendChild(sub2); var child2 = document.createElement("child2"); sub2.appendChild(child2); text = document.createTextNode("descendant number 2"); child2.appendChild(text); domTestHelper.arrayEqual(assert, [child1,child2], xpath.evaluate("descendant::child1|descendant::child2", document, doc).nodes); }); specify("NIST_expression010", function() { const document = (new JSDOM("", { contentType: "application/xml" })).window.document; var doc = document.documentElement; var sub1 = document.createElement("sub1"); doc.appendChild(sub1); var child1 = document.createElement("child1"); sub1.appendChild(child1); var text = document.createTextNode("descendant number 1"); child1.appendChild(text); var sub2 = document.createElement("sub2"); doc.appendChild(sub2); var child2 = document.createElement("child2"); sub2.appendChild(child2); text = document.createTextNode("descendant number 2"); child2.appendChild(text); domTestHelper.arrayEqual(assert, [doc], xpath.evaluate("descendant-or-self::doc|descendant-or-self::doc", document, doc).nodes); }); specify("NIST_expression011", function() { const document = (new JSDOM("", { contentType: "application/xml" })).window.document; var doc = document.documentElement; var book1 = document.createElement("book"); doc.appendChild(book1); var author1 = document.createElement("author"); book1.appendChild(author1); var name = document.createElement("name"); author1.appendChild(name); name.setAttribute("real", "no"); var text = document.createTextNode("Carmelo Montanez"); name.appendChild(text); var chapters = document.createElement("chapters"); author1.appendChild(chapters); text = document.createTextNode("Nine"); chapters.appendChild(text); var bibliography = document.createElement("bibliography"); author1.appendChild(bibliography); var book2 = document.createElement("book"); doc.appendChild(book2); var author2 = document.createElement("author"); book2.appendChild(author2); name = document.createElement("name"); author2.appendChild(name); name.setAttribute("real", "na"); text = document.createTextNode("David Marston"); name.appendChild(text); chapters = document.createElement("chapters"); author2.appendChild(chapters); text = document.createTextNode("Seven"); chapters.appendChild(text); bibliography = document.createElement("bibliography"); author2.appendChild(bibliography); var book3 = document.createElement("book"); doc.appendChild(book3); var author3 = document.createElement("author"); book3.appendChild(author3); name = document.createElement("name"); author3.appendChild(name); name.setAttribute("real", "yes"); text = document.createTextNode("Mary Brady"); name.appendChild(text); chapters = document.createElement("chapters"); author3.appendChild(chapters); text = document.createTextNode("Ten"); bibliography = document.createElement("bibliography"); author3.appendChild(bibliography); domTestHelper.arrayEqual(assert, [author1], xpath.evaluate("author[name='Mary Brady']|author[name/@real='no']", document, book1).nodes); domTestHelper.arrayEqual(assert, [], xpath.evaluate("author[name='Mary Brady']|author[name/@real='no']", document, book2).nodes); domTestHelper.arrayEqual(assert, [author3], xpath.evaluate("author[name='Mary Brady']|author[name/@real='no']", document, book3).nodes); }); // expression012 tests XPath variables, amongst other features, and is // omitted as above for other tests. A modified version that does not test // variables is included below. // // exports.NIST_expression012 = function(test) { // const document = (new JSDOM("", { contentType: "application/xml" })).window.document; // var doc = document.documentElement; // var child1 = document.createElement("child1"); // doc.appendChild(child1); // var text = document.createTextNode("child number 1"); // child.appendChild(text); // var child2 = document.createElement("child2"); // doc.appendChild(child2); // text = document.createTextNode("child number 2"); // child2.appendChild(text); // var child3 = document.createElement("child3"); // doc.appendChild(child3); // text = document.createTextNode("Selection of this child is an error."); // child3.appendChild(text); // // var result1 = xpath.evaluate("//noChild1", document, doc); // domTestHelper.arrayEqual(test, [], result1.nodes); // // var result2 = xpath.evaluate("//noChild2", document, doc); // domTestHelper.arrayEqual(test, [], result2.nodes); // // // set $var1 = result1.nodes // // set $var2 = result2.nodes // // domTestHelper.arrayEqual(test, [], // xpath.evaluate("$var1|$var2", document, docu)); // }; specify("NIST_expression012_noVariables", function() { const document = (new JSDOM("", { contentType: "application/xml" })).window.document; var doc = document.documentElement; var child1 = document.createElement("child1"); doc.appendChild(child1); var text = document.createTextNode("child number 1"); child1.appendChild(text); var child2 = document.createElement("child2"); doc.appendChild(child2); text = document.createTextNode("child number 2"); child2.appendChild(text); var child3 = document.createElement("child3"); doc.appendChild(child3); text = document.createTextNode("Selection of this child is an error."); child3.appendChild(text); domTestHelper.arrayEqual(assert, [], xpath.evaluate("//noChild1", document, doc).nodes); domTestHelper.arrayEqual(assert, [], xpath.evaluate("//noChild2", document, doc).nodes); domTestHelper.arrayEqual(assert, [], xpath.evaluate("//noChild1|//noChild2", document, doc).nodes); }); specify("NIST_expression013", function() { const document = (new JSDOM("", { contentType: "application/xml" })).window.document; var doc = document.documentElement; var sub1 = document.createElement("sub1"); doc.appendChild(sub1); var child1 = document.createElement("child1"); sub1.appendChild(child1); var text = document.createTextNode("preceding sibling number 1"); child1.appendChild(text); var child2 = document.createElement("child2"); sub1.appendChild(child2); text = document.createTextNode("current node"); child2.appendChild(text); var child3 = document.createElement("child3"); sub1.appendChild(child3); text = document.createTextNode("following sibling number 3"); child3.appendChild(text); domTestHelper.arrayEqual(assert, [child2], xpath.evaluate("//child2", document, doc).nodes); domTestHelper.arrayEqual(assert, [child1, child3], xpath.evaluate("preceding-sibling::child1|following-sibling::child3", document, child2).nodes); }); // expression014 and expression015 are omitted because they test the XSLT // key() function. specify("NIST_expression016", function() { const document = (new JSDOM("", { contentType: "application/xml" })).window.document; var doc = document.documentElement; var book1 = document.createElement("book"); doc.appendChild(book1); var author1 = document.createElement("author"); book1.appendChild(author1); var name1 = document.createElement("name"); author1.appendChild(name1); name1.setAttribute("real", "no"); var text = document.createTextNode("Carmelo Montanez"); name1.appendChild(text); var chapters = document.createElement("chapters"); author1.appendChild(chapters); text = document.createTextNode("Nine"); chapters.appendChild(text); var bibliography = document.createElement("bibliography"); author1.appendChild(bibliography); var book2 = document.createElement("book"); doc.appendChild(book2); var author2 = document.createElement("author"); book2.appendChild(author2); var name2 = document.createElement("name"); author2.appendChild(name2); name2.setAttribute("real", "na"); text = document.createTextNode("David Marston"); name2.appendChild(text); chapters = document.createElement("chapters"); author2.appendChild(chapters); text = document.createTextNode("Seven"); chapters.appendChild(text); bibliography = document.createElement("bibliography"); author2.appendChild(bibliography); var book3 = document.createElement("book"); doc.appendChild(book3); var author3 = document.createElement("author"); book3.appendChild(author3); var name3 = document.createElement("name"); author3.appendChild(name3); name3.setAttribute("real", "yes"); text = document.createTextNode("Mary Brady"); name3.appendChild(text); chapters = document.createElement("chapters"); author3.appendChild(chapters); text = document.createTextNode("Ten"); bibliography = document.createElement("bibliography"); author3.appendChild(bibliography); var author4 = document.createElement("author"); bibliography.appendChild(author4); var name4 = document.createElement("name"); author4.appendChild(name4); text = document.createTextNode("Lynne Rosenthal"); name4.appendChild(text); chapters = document.createElement("chapters"); author4.appendChild(chapters); text = document.createTextNode("Five"); chapters.appendChild(text); domTestHelper.arrayEqual(assert, [name1], xpath.evaluate("author/name|author/bibliography/author/name", document, book1).nodes); domTestHelper.arrayEqual(assert, [name2], xpath.evaluate("author/name|author/bibliography/author/name", document, book2).nodes); domTestHelper.arrayEqual(assert, [name3, name4], xpath.evaluate("author/name|author/bibliography/author/name", document, book3).nodes); }); specify("NIST_expression017", function() { const document = (new JSDOM("", { contentType: "application/xml" })).window.document; var doc = document.documentElement; var book1 = document.createElement("book"); doc.appendChild(book1); var author1 = document.createElement("author"); book1.appendChild(author1); var name1 = document.createElement("name"); author1.appendChild(name1); name1.setAttribute("real", "no"); var text = document.createTextNode("Carmelo Montanez"); name1.appendChild(text); var chapters = document.createElement("chapters"); author1.appendChild(chapters); text = document.createTextNode("Nine"); chapters.appendChild(text); var bibliography = document.createElement("bibliography"); author1.appendChild(bibliography); var book2 = document.createElement("book"); doc.appendChild(book2); var author2 = document.createElement("author"); book2.appendChild(author2); var name2 = document.createElement("name"); author2.appendChild(name2); name2.setAttribute("real", "na"); text = document.createTextNode("David Marston"); name2.appendChild(text); chapters = document.createElement("chapters"); author2.appendChild(chapters); text = document.createTextNode("Seven"); chapters.appendChild(text); bibliography = document.createElement("bibliography"); author2.appendChild(bibliography); var book3 = document.createElement("book"); doc.appendChild(book3); var author3 = document.createElement("author"); book3.appendChild(author3); var name3 = document.createElement("name"); author3.appendChild(name3); name3.setAttribute("real", "yes"); text = document.createTextNode("Mary Brady"); name3.appendChild(text); chapters = document.createElement("chapters"); author3.appendChild(chapters); text = document.createTextNode("Ten"); bibliography = document.createElement("bibliography"); author3.appendChild(bibliography); var author4 = document.createElement("author"); bibliography.appendChild(author4); var name4 = document.createElement("name"); author4.appendChild(name4); text = document.createTextNode("Lynne Rosenthal"); name4.appendChild(text); chapters = document.createElement("chapters"); author4.appendChild(chapters); text = document.createTextNode("Five"); chapters.appendChild(text); domTestHelper.arrayEqual(assert, [name1], xpath.evaluate("author/name|author/bibliography/author/chapters", document, book1).nodes); domTestHelper.arrayEqual(assert, [name2], xpath.evaluate("author/name|author/bibliography/author/chapters", document, book2).nodes); domTestHelper.arrayEqual(assert, [name3, chapters], xpath.evaluate("author/name|author/bibliography/author/chapters", document, book3).nodes); }); specify("NIST_expression018", function() { const document = (new JSDOM("", { contentType: "application/xml" })).window.document; var doc = document.documentElement; var book1 = document.createElement("book"); doc.appendChild(book1); var author1 = document.createElement("author"); book1.appendChild(author1); var name1 = document.createElement("name"); author1.appendChild(name1); name1.setAttribute("real", "na"); var text = document.createTextNode("David Marston"); name1.appendChild(text); var chapters1 = document.createElement("chapters"); author1.appendChild(chapters1); text = document.createTextNode("Seven"); chapters1.appendChild(text); var bibliography1 = document.createElement("bibliography"); author1.appendChild(bibliography1); var book2 = document.createElement("book"); doc.appendChild(book2); var author2 = document.createElement("author"); book2.appendChild(author2); var name2 = document.createElement("name"); author2.appendChild(name2); name2.setAttribute("real", "yes"); text = document.createTextNode("Mary Brady"); name2.appendChild(text); var chapters2 = document.createElement("chapters"); author2.appendChild(chapters2); text = document.createTextNode("Ten"); chapters2.appendChild(text); var bibliography2 = document.createElement("bibliography"); author2.appendChild(bibliography2); domTestHelper.arrayEqual(assert, [name1], xpath.evaluate("author/name|author/noElement", document, book1).nodes); domTestHelper.arrayEqual(assert, [name2], xpath.evaluate("author/name|author/noElement", document, book2).nodes); }); // expression019 tests XPath variables, amongst other features, and is // omitted as above for other tests. A modified version that does not test // variables is included below. // // exports.NIST_expression019 = function(test) { // const document = (new JSDOM("", { contentType: "application/xml" })).window.document; // var doc = document.documentElement; // var child1 = document.createElement("child1"); // doc.appendChild(child1); // var text = document.createTextNode("Text for variable 1."); // child1.appendChild(text); // var child2 = document.createElement("child2"); // doc.appendChild(child2); // text = document.createTextNode("Selection of this child is an error."); // child2.appendChild(text); // var child3 = document.createElement("child3"); // doc.appendChild(child3); // text = document.createTextNode("Selection of this child is an error."); // child3.appendChild(text); // // var result = xpath.evaluate("//child1", document, doc); // domTestHelper.arrayEqual(test, [child1], result.nodes); // // // set $var1 = result.nodes // // set $var2 = result.nodes // // domTestHelper.arrayEqual(test, [child1], // xpath.evaluate("$var1|$var2", document, doc)); // }; specify("NIST_expression019_noVariables", function() { const document = (new JSDOM("", { contentType: "application/xml" })).window.document; var doc = document.documentElement; var child1 = document.createElement("child1"); doc.appendChild(child1); var text = document.createTextNode("Text for variable 1."); child1.appendChild(text); var child2 = document.createElement("child2"); doc.appendChild(child2); text = document.createTextNode("Selection of this child is an error."); child2.appendChild(text); var child3 = document.createElement("child3"); doc.appendChild(child3); text = document.createTextNode("Selection of this child is an error."); child3.appendChild(text); var result = xpath.evaluate("//child1", document, doc); domTestHelper.arrayEqual(assert, [child1], result.nodes); domTestHelper.arrayEqual(assert, [child1], xpath.evaluate("//child1|//child1", document, doc).nodes); }); specify("NIST_expression020", function() { const document = (new JSDOM("", { contentType: "application/xml" })).window.document; var doc = document.documentElement; var sub1 = document.createElement("sub1"); doc.appendChild(sub1); var child1 = document.createElement("child1"); sub1.appendChild(child1); var text = document.createTextNode("child1"); child1.appendChild(text); var sub2 = document.createElement("sub2"); doc.appendChild(sub2); var child2 = document.createElement("child2"); sub2.appendChild(child2); text = document.createTextNode("child2"); child2.appendChild(text); domTestHelper.arrayEqual(assert, [child1, child2], xpath.evaluate("sub1/child1|sub2/child2", document, doc).nodes); }); specify("NIST_expression021", function() { const document = (new JSDOM("", { contentType: "application/xml" })).window.document; var doc = document.documentElement; var sub1 = document.createElement("sub1"); doc.appendChild(sub1); var child1 = document.createElement("child1"); sub1.appendChild(child1); var text = document.createTextNode("self content number 1"); child1.appendChild(text); var sub2 = document.createElement("sub2"); doc.appendChild(sub2); var child2 = document.createElement("child2"); sub2.appendChild(child2); text = document.createTextNode("self content number 2"); child2.appendChild(text); domTestHelper.arrayEqual(assert, [child1, child2], xpath.evaluate("//child1|//child2", document, doc).nodes); domTestHelper.arrayEqual(assert, [child1], xpath.evaluate("self::child1|self::child2", document, child1).nodes); domTestHelper.arrayEqual(assert, [child2], xpath.evaluate("self::child1|self::child2", document, child2).nodes); }); specify("NIST_expression022", function() { const document = (new JSDOM("", { contentType: "application/xml" })).window.document; var doc = document.documentElement; var child1 = document.createElement("child1"); doc.appendChild(child1); var text = document.createTextNode("1"); child1.appendChild(text); var child2 = document.createElement("child2"); doc.appendChild(child2); text = document.createTextNode("2"); child2.appendChild(text); domTestHelper.arrayEqual(assert, [child1, child2], xpath.evaluate("//child1|//child2", document, doc).nodes); }); specify("NIST_expression023", function() { const document = (new JSDOM("", { contentType: "application/xml" })).window.document; var doc = document.documentElement; var child1 = document.createElement("child1"); doc.appendChild(child1); var text = document.createTextNode("1"); child1.appendChild(text); var child2 = document.createElement("child2"); doc.appendChild(child2); text = document.createTextNode("2"); child2.appendChild(text); var child3 = document.createElement("child3"); doc.appendChild(child3); text = document.createTextNode("3"); child3.appendChild(text); domTestHelper.arrayEqual(assert, [child1, child2, child3], xpath.evaluate("//child1|//child2|//child3", document, doc).nodes); }); // expression024 is omitted because it tests the XSLT key() function. // expression025 tests XPath variables, amongst other features, and is // omitted as above for other tests. A modified version that does not test // variables is included below. // // exports.NIST_expression025 = function(test) { // const document = (new JSDOM("", { contentType: "application/xml" })).window.document; // var doc = document.documentElement; // var child1 = document.createElement("child1"); // doc.appendChild(child1); // var text = document.createTextNode("Text for variable"); // child1.appendChild(text); // var child2 = document.createElement("child2"); // doc.appendChild(child2); // text = document.createTextNode("Text for location Path"); // child2.appendChild(text); // var child3 = document.createElement("child3"); // text = document.createTextNode("Selection of this child is an error"); // child3.appendChild(text); // // var result = xpath.evaluate("//child1", document, doc); // domTestHelper.arrayEqual(test, [child1], result.nodes); // // // set $var1 = result.nodes // // domTestHelper.arrayEqual(test, [child1, child2], // xpath.evaluate("$var1|child::child2", document, doc).nodes); // }; specify("NIST_expression025_noVariables", function() { const document = (new JSDOM("", { contentType: "application/xml" })).window.document; var doc = document.documentElement; var child1 = document.createElement("child1"); doc.appendChild(child1); var text = document.createTextNode("Text for variable"); child1.appendChild(text); var child2 = document.createElement("child2"); doc.appendChild(child2); text = document.createTextNode("Text for location Path"); child2.appendChild(text); var child3 = document.createElement("child3"); text = document.createTextNode("Selection of this child is an error"); child3.appendChild(text); var result = xpath.evaluate("//child1", document, doc); domTestHelper.arrayEqual(assert, [child1], result.nodes); domTestHelper.arrayEqual(assert, [child1, child2], xpath.evaluate("//child1|child::child2", document, doc).nodes); }); // expression026 tests XPath variables, so it is omitted as above. There is no // modified version of this test that does not use variables, because it would // be redundant with other tests. // // exports.NIST_expression026 = function(test) { // const document = (new JSDOM("", { contentType: "application/xml" })).window.document; // var doc = document.documentElement; // var child1 = document.createElement("child1"); // doc.appendChild(child1); // var text = document.createTextNode("child number 1"); // child1.appendChild(text); // var child2 = document.createElement("child2"); // doc.appendChild(child2); // text = document.createTextNode("child number 2"); // child2.appendChild(text); // var child3 = document.createElement("child3"); // text = document.createTextNode("Selection of this child is an error"); // child3.appendChild(text); // // var result1 = xpath.evaluate("//child1", document, doc); // domTestHelper.arrayEqual(test, [child1], result1.nodes); // // var result2 = xpath.evaluate("//child2", document, doc); // domTestHelper.arrayEqual(test, [child2], result2.nodes); // // // set $var1 = result1.nodes // // set $var2 = result2.nodes // // domTestHelper.arrayEqual(test, [child1, child2], // xpath.evaluate("$var1|$var2", document, doc).nodes); // }; specify("NIST_expression027", function() { const document = (new JSDOM("", { contentType: "application/xml" })).window.document; assert.equal(true, xpath.evaluate("(-0 = 0)", document, document)); }); specify("NIST_expression028", function() { const document = (new JSDOM("", { contentType: "application/xml" })).window.document; assert.equal(false, xpath.evaluate("(-0 < 0)", document, document)); }); specify("NIST_expression029", function() { const document = (new JSDOM("", { contentType: "application/xml" })).window.document; assert.equal(false, xpath.evaluate("(-0 > 0)", document, document)); }); specify("NIST_expression030", function() { const document = (new JSDOM("", { contentType: "application/xml" })).window.document; assert.equal(true, xpath.evaluate("(-0 >= 0)", document, document)); }); specify("NIST_expression031", function() { const document = (new JSDOM("", { contentType: "application/xml" })).window.document; assert.equal(true, xpath.evaluate("(-0 <= 0)", document, document)); }); specify("NIST_expression032", function() { const document = (new JSDOM("", { contentType: "application/xml" })).window.document; assert.equal(false, xpath.evaluate("(-0 != 0)", document, document)); }); specify("NIST_expression033", function() { const document = (new JSDOM("", { contentType: "application/xml" })).window.document; assert.equal(true, xpath.evaluate("2.1 > 2.0", document, document)); assert.equal(false, xpath.evaluate("2.1 < 2.0", document, document)); assert.equal(false, xpath.evaluate("2.1 = 2.0", document, document)); assert.equal(false, xpath.evaluate("2.1 > NaN", document, document)); }); specify("NIST_expression034", function() { const document = (new JSDOM("", { contentType: "application/xml" })).window.document; assert.equal(true, xpath.evaluate("2.0 < 2.1", document, document)); assert.equal(false, xpath.evaluate("2.0 > 2.1", document, document)); assert.equal(false, xpath.evaluate("2.0 = 2.1", document, document)); assert.equal(false, xpath.evaluate("2.0 < NaN", document, document)); }); specify("NIST_expression035", function() { const document = (new JSDOM("", { contentType: "application/xml" })).window.document; assert.equal(true, xpath.evaluate("2.0 <= 2.0", document, document)); assert.equal(false, xpath.evaluate("2.0 > 2.0", document, document)); assert.equal(true, xpath.evaluate("2.0 = 2.0", document, document)); assert.equal(false, xpath.evaluate("2.0 <= NaN", document, document)); }); specify("NIST_expression036", function() { const document = (new JSDOM("", { contentType: "application/xml" })).window.document; assert.equal(true, xpath.evaluate("2.0 >= 2.0", document, document)); assert.equal(false, xpath.evaluate("2.0 < 2.0", document, document)); assert.equal(true, xpath.evaluate("2.0 = 2.0", document, document)); assert.equal(false, xpath.evaluate("2.0 <= NaN", document, document)); }); specify("NIST_locationPath001", function() { const document = (new JSDOM("", { contentType: "application/xml" })).window.document; var doc = document.documentElement; var child1 = document.createElement("child1"); doc.appendChild(child1); var text = document.createTextNode("Text from child1"); child1.appendChild(text); var child2 = document.createElement("child2"); child1.appendChild(child2); domTestHelper.arrayEqual(assert, [child1], xpath.evaluate("child1[child::child2]", document, doc).nodes); }); specify("NIST_locationPath002", function() { const document = (new JSDOM("", { contentType: "application/xml" })).window.document; var doc = document.documentElement; var element1 = document.createElement("element1"); var text = document.createTextNode("Text from first element"); element1.appendChild(text); var child1a = document.createElement("child1"); element1.appendChild(child1a); text = document.createTextNode("Text from child1 of first element"); child1a.appendChild(text); var child2a = document.createElement("child2"); element1.appendChild(child2a); text = document.createTextNode("Text from child2 of first element"); child2a.appendChild(text); var element2 = document.createElement("element2"); doc.appendChild(element2); text = document.createTextNode("Text from second element"); element2.appendChild(text); var child1b = document.createElement("child1"); element2.appendChild(child1b); text = document.createTextNode("Text from child1 of second element"); child1b.appendChild(text); var child2b = document.createElement("child2"); element2.appendChild(child2b); text = document.createTextNode("Text from child2 of second element (corect execution!!)"); child2b.appendChild(text); domTestHelper.arrayEqual(assert, [child2b], xpath.evaluate("//child2[ancestor::element2]", document, doc).nodes); }); specify("NIST_locationPath003", function() { const document = (new JSDOM("", { contentType: "application/xml" })).window.document; var doc = document.documentElement; var element1 = document.createElement("element1"); var text = document.createTextNode("Text from first element"); element1.appendChild(text); var child1a = document.createElement("child1"); element1.appendChild(child1a); text = document.createTextNode("Text from child1 of first element"); child1a.appendChild(text); var child2a = document.createElement("child2"); element1.appendChild(child2a); text = document.createTextNode("Text from child2 of first element"); child2a.appendChild(text); var element2 = document.createElement("element2"); doc.appendChild(element2); text = document.createTextNode("Text from second element"); element2.appendChild(text); var child1b = document.createElement("child1"); element2.appendChild(child1b); text = document.createTextNode("Text from child1 of second element"); child1b.appendChild(text); var child2b = document.createElement("child2"); element2.appendChild(child2b); text = document.createTextNode("Text from child2 of second element (corect execution!!)"); child2b.appendChild(text); domTestHelper.arrayEqual(assert, [child2b], xpath.evaluate("//child2[ancestor-or-self::element2]", document, doc).nodes); }); specify("NIST_locationPath004", function() { const document = (new JSDOM("", { contentType: "application/xml" })).window.document; var doc = document.documentElement; var element1 = document.createElement("element1"); var text = document.createTextNode("Text from first element"); element1.appendChild(text); var child1a = document.createElement("child1"); element1.appendChild(child1a); text = document.createTextNode("Text from child1 of first element"); child1a.appendChild(text); var child2a = document.createElement("child2"); element1.appendChild(child2a); text = document.createTextNode("Text from child2 of first element"); child2a.appendChild(text); var element2 = document.createElement("element2"); doc.appendChild(element2); text = document.createTextNode("Text from second element"); element2.appendChild(text); var child1b = document.createElement("child1"); element2.appendChild(child1b); text = document.createTextNode("Text from child1 of second element"); child1b.appendChild(text); var child2b = document.createElement("child2"); child2b.setAttribute("attr1", "yes"); element2.appendChild(child2b); text = document.createTextNode("Text from child2 of second element (corect execution!!)"); child2b.appendChild(text); domTestHelper.arrayEqual(assert, [child2b], xpath.evaluate("//child2[attribute::attr1]", document, doc).nodes); }); specify("NIST_locationPath005", function() { const document = (new JSDOM("", { contentType: "application/xml" })).window.document; var doc = document.documentElement; var element1a = document.createElement("element1"); doc.appendChild(element1a); var text = document.createTextNode("Text from first element (correct execution)!!!"); element1a.appendChild(text); var child1 = document.createElement("child1"); element1a.appendChild(child1); var child2 = document.createElement("child2"); element1a.appendChild(child2); var element1b = document.createElement("element1"); doc.appendChild(element1b); text = document.createTextNode("Text from second element"); element1b.appendChild(text); child1 = document.createElement("child1"); element1b.appendChild(child1); text = document.createTextNode("Text from child1 of second element"); child1.appendChild(text); domTestHelper.arrayEqual(assert, [element1a], xpath.evaluate("element1[descendant-or-self::child2]", document, doc).nodes); }); specify("NIST_locationPath006", function() { const document = (new JSDOM("", { contentType: "application/xml" })).window.document; var doc = document.documentElement; var element1 = document.createElement("element1"); doc.appendChild(element1); var child1a = document.createElement("child1"); element1.appendChild(child1a); var text = document.createTextNode("Test executed successfully!!") child1a.appendChild(text); var child2 = document.createElement("child2"); element1.appendChild(child2); text = document.createTextNode("child2"); child2.appendChild(text); var element2 = document.createElement("element2"); doc.appendChild(element2); var child1b = document.createElement("child1"); element2.appendChild(child1b); text = document.createTextNode("Wrong node selected!!"); child1b.appendChild(text); var element3 = document.createElement("element3"); doc.appendChild(element3); var child1c = document.createElement("child1"); element3.appendChild(child1c); text = document.createTextNode("Wrong node selected!!"); child1c.appendChild(text); domTestHelper.arrayEqual(assert, [child1a], xpath.evaluate("//child1[parent::element1]", document, doc).nodes); }); specify("NIST_locationPath007", function() { const document = (new JSDOM("", { contentType: "application/xml" })).window.document; var doc = document.documentElement; var element1a = document.createElement("element1"); doc.appendChild(element1a); var text = document.createTextNode("Wrong node selected!!"); element1a.appendChild(text); var element1b = document.createElement("element1"); doc.appendChild(element1b); text = document.createTextNode("Test executed successfully!!"); element1b.appendChild(text); var element1c = document.createElement("element1"); doc.appendChild(element1c); text = document.createTextNode("Wrong node selected!!"); element1c.appendChild(text); domTestHelper.arrayEqual(assert, [element1b], xpath.evaluate("element1[(((((2*10)-4)+9) div 5) mod 3 )]", document, doc).nodes); }); specify("NIST_locationPath008", function() { const document = (new JSDOM("", { contentType: "application/xml" })).window.document; var doc = document.documentElement; var element1a = document.createElement("element1"); doc.appendChild(element1a); var text = document.createTextNode("Wrong node selected!!"); element1a.appendChild(text); var element1b = document.createElement("element1"); doc.appendChild(element1b); text = document.createTextNode("Test executed successfully!!"); element1b.appendChild(text); var element1c = document.createElement("element1"); doc.appendChild(element1c); text = document.createTextNode("Wrong node selected!!"); element1c.appendChild(text); domTestHelper.arrayEqual(assert, [element1b], xpath.evaluate("element1[(((((2*10)-4)+9) div 5) mod floor(3))]", document, doc).nodes); }); specify("NIST_locationPath009", function() { const document = (new JSDOM("", { contentType: "application/xml" })).window.document; var doc = document.documentElement; var element1a = document.createElement("element1"); doc.appendChild(element1a); var text = document.createTextNode("Wrong node selected!!"); element1a.appendChild(text); var element1b = document.createElement("element1"); doc.appendChild(element1b); text = document.createTextNode("Test executed successfully!!"); element1b.appendChild(text); var element1c = document.createElement("element1"); doc.appendChild(element1c); text = document.createTextNode("Wrong node selected!!"); element1c.appendChild(text); domTestHelper.arrayEqual(assert, [element1b], xpath.evaluate("element1[floor(2)]", document, doc).nodes); }); specify("NIST_locationPath010", function() { const document = (new JSDOM("", { contentType: "application/xml" })).window.document; var doc = document.documentElement; var element1a = document.createElement("element1"); doc.appendChild(element1a); var text = document.createTextNode("Wrong Node Selected!!"); element1a.appendChild(text); var element1b = document.createElement("element1"); doc.appendChild(element1b); var child1a = document.createElement("child1"); element1b.appendChild(child1a); text = document.createTextNode("Wrong Node Selected!!"); child1a.appendChild(text); var child1b = document.createElement("child1"); element1b.appendChild(child1b); text = document.createTextNode("Wrong Node Selected!!"); child1b.appendChild(text); var child1c = document.createElement("child1"); element1b.appendChild(child1c); text = document.createTextNode("Test Executed Successfully!!"); child1c.appendChild(text); var element1c = document.createElement("element1"); doc.appendChild(element1c); text = document.createTextNode("Wrong Node Selected!!"); element1c.appendChild(text); domTestHelper.arrayEqual(assert, [child1c], xpath.evaluate("doc/element1[(((((2*10)-4)+9) div 5) mod 3)]/child1[last()]", document, document).nodes); }); }); jsdom-19.0.0/test/to-port-to-wpts/location.js000066400000000000000000000070631415223704400210710ustar00rootroot00000000000000"use strict"; const { assert } = require("chai"); const { describe, specify } = require("mocha-sugar-free"); const { JSDOM } = require("../.."); describe("location", () => { specify("window.location and document.location should be equal", () => { const { window } = new JSDOM(); assert.strictEqual(window.document.location, window.location); }); specify("window.location.href for a default window is about:blank", () => { const { window } = new JSDOM(); assert.equal(window.location.href, "about:blank"); }); specify("window.location.port for an about:blank window", () => { const { window } = new JSDOM(); assert.equal(window.location.port, ""); }); specify("window.location.hash is manipulable", () => { const { window } = new JSDOM(``, { url: "http://www.example.com/" }); const defaultHref = window.location.href; assert.equal(window.location.hash, ""); window.location.href += "#foobar"; assert.equal(window.location.hash, "#foobar"); window.location.hash = "#baz"; assert.equal(window.location.hash, "#baz"); assert.equal(window.location.href, defaultHref + "#baz"); }); specify( "window.location.hash is manipulable even for about:blank (GH-1289)", () => { const { window } = new JSDOM(``, { url: "about:blank" }); assert.equal(window.location.hash, ""); window.location.hash = "#baz"; assert.equal(window.location.hash, "#baz"); assert.equal(window.location.href, "about:blank#baz"); } ); specify( "when changing window.location.href by adding a hash, should fire a hashchange event", t => { const { window } = new JSDOM(``, { url: "http://www.example.com/" }); window.addEventListener("hashchange", event => { assert.strictEqual(event.bubbles, false); assert.strictEqual(event.cancelable, false); assert.strictEqual(event.oldURL, "http://www.example.com/"); assert.strictEqual(event.newURL, "http://www.example.com/#foo"); assert.ok(true, "hashchange event was fired"); t.done(); }); window.location.href += "#foo"; }, { async: true } ); specify( "when changing window.location.hash directly, should fire a hashchange event", t => { const { window } = new JSDOM(``, { url: "http://www.example.com/" }); window.addEventListener("hashchange", event => { assert.strictEqual(event.bubbles, false); assert.strictEqual(event.cancelable, false); assert.strictEqual(event.oldURL, "http://www.example.com/"); assert.strictEqual(event.newURL, "http://www.example.com/#foo"); assert.ok(true, "hashchange event was fired"); t.done(); }); window.location.hash = "#foo"; }, { async: true } ); specify("window.location components are correct", () => { const { window } = new JSDOM(``, { url: "http://www.example.com:1234/path/to/foo.txt?blahblah#hash" }); assert.strictEqual(window.location.href, "http://www.example.com:1234/path/to/foo.txt?blahblah#hash"); assert.strictEqual(window.location.origin, "http://www.example.com:1234"); assert.strictEqual(window.location.protocol, "http:"); assert.strictEqual(window.location.host, "www.example.com:1234"); assert.strictEqual(window.location.hostname, "www.example.com"); assert.strictEqual(window.location.port, "1234"); assert.strictEqual(window.location.pathname, "/path/to/foo.txt"); assert.strictEqual(window.location.search, "?blahblah"); assert.strictEqual(window.location.hash, "#hash"); }); }); jsdom-19.0.0/test/to-port-to-wpts/message-event.js000066400000000000000000000015261415223704400220220ustar00rootroot00000000000000"use strict"; const { assert } = require("chai"); const { describe, specify } = require("mocha-sugar-free"); const { JSDOM } = require("../.."); // Tests for MessageEvent // Spec: https://html.spec.whatwg.org/multipage/comms.html#messageevent describe("location", () => { specify("MessageEvent has a read-only property 'type'", () => { const { window } = new JSDOM(); const event = new window.MessageEvent("fake type"); assert.equal(event.type, "fake type"); assert.throws(() => { event.type = "oh no"; }); }); specify("MessageEvent has a read-only property 'data'", () => { const { window } = new JSDOM(); const event = new window.MessageEvent("fake type", { data: "fake data" }); assert.equal(event.data, "fake data"); assert.throws(() => { event.data = "oh no"; }); }); }); jsdom-19.0.0/test/to-port-to-wpts/misc.js000066400000000000000000000330251415223704400202110ustar00rootroot00000000000000"use strict"; const { assert } = require("chai"); const { describe, specify } = require("mocha-sugar-free"); const { JSDOM } = require("../.."); describe("browser/index", () => { specify("notfound_getelementsbyclassname", () => { const doc = (new JSDOM()).window.document; const { body } = doc; const p = doc.createElement("p"); p.className = "unknown"; body.appendChild(p); const elements = doc.getElementsByClassName("first-p"); assert.equal(elements.length, 0, "no results"); }); specify("basic_getelementsbyclassname", () => { const doc = (new JSDOM()).window.document; const { body } = doc; const p = doc.createElement("p"); p.className = "first-p"; body.appendChild(p); const elements = doc.getElementsByClassName("first-p"); assert.equal(elements.item(0), p, "p and first-p"); }); specify("multiple_getelementsbyclassname", () => { const doc = (new JSDOM()).window.document; const { body } = doc; const p = doc.createElement("p"); p.className = "first-p second third"; body.appendChild(p); const first = doc.getElementsByClassName("first-p").item(0); const second = doc.getElementsByClassName("second").item(0); const third = doc.getElementsByClassName("third").item(0); assert.equal(first, p, "p and first-p"); assert.equal(second, p, "p and second"); assert.equal(third, p, "p and third"); }); specify("testclassnameworksasexpected", () => { const doc = (new JSDOM()).window.document; const p = doc.createElement("p"); p.setAttribute("class", "first-p"); assert.equal(p.className, "first-p", "class attribute is same as className"); p.className += " second"; assert.equal(p.className, "first-p second", "className getter/setter"); }); specify("basic_getelementbyid", () => { const doc = (new JSDOM()).window.document; const { body } = doc; const p = doc.createElement("p"); p.id = "theid"; body.appendChild(p); const element = doc.getElementById("theid"); assert.equal(element, p, "p and #theid"); }); specify("nonexistant_getelementbyid", () => { const doc = (new JSDOM()).window.document; const { body } = doc; const p = doc.createElement("p"); p.id = "theid"; body.appendChild(p); const element = doc.getElementById("non-existant-id"); assert.equal(element, null, "p and #theid"); }); specify("remove_nonexistantattribute", () => { const doc = (new JSDOM()).window.document; const { body } = doc; assert.doesNotThrow(() => body.removeAttribute("non-existant"), "setValue_throws_NO_MODIFICATION_ERR"); }); specify("render_singletag", () => { const doc = (new JSDOM()).window.document; const p = doc.createElement("p"); const img = doc.createElement("img"); p.appendChild(img); const out = p.outerHTML; assert.equal(out.match(/<\/img>/), null, "end tag not included in output"); }); specify("render_specialchars", () => { const doc = (new JSDOM()).window.document; const p = doc.createElement("p"); const specials = "\"<>&\xA0"; const escapedSpecials = "\"<>& "; p.setAttribute("specials", specials); p.innerHTML = escapedSpecials; const pp = doc.createElement("p"); pp.appendChild(p); assert.equal(pp.innerHTML, `

      "<>& 

      `); }); specify("parse_scripttags", () => { const doc = (new JSDOM()).window.document; const { head } = doc; const scriptHtml = ``; head.innerHTML = scriptHtml; assert.equal(scriptHtml, head.innerHTML, "original and processed"); }); specify("parse_styletags", () => { const doc = (new JSDOM()).window.document; const { head } = doc; const styleHtml = ``; head.innerHTML = styleHtml; assert.equal(styleHtml, head.innerHTML, "original and processed"); }); specify("parse_doublespacetags", () => { const doc = (new JSDOM()).window.document; const html = ``; assert.doesNotThrow(() => doc.write(html), "setValue_throws_INVALID_CHARACTER_ERR"); }); specify("serialize_styleattribute", () => { const doc = (new JSDOM()).window.document; doc.documentElement.style.color = "black"; doc.documentElement.style.backgroundColor = "white"; assert.equal( doc.documentElement.outerHTML, `` ); }); specify("innerhtml_removeallchildren", () => { const doc = (new JSDOM()).window.document; const { body } = doc; body.appendChild(doc.createElement("p")); body.innerHTML = ""; assert.equal(body.childNodes.length, 0, "still has children"); }); specify("innerhtml_null", () => { const doc = (new JSDOM()).window.document; const { body } = doc; body.appendChild(doc.createElement("p")); body.innerHTML = null; assert.equal(body.childNodes.length, 0, "still has children"); }); specify("parse_doctype_containing_newline", () => { const html = `\n`; const doc = (new JSDOM(html)).window.document; assert.ok(doc.doctype, "doctype should not be falsy"); }); specify("basic_nodelist_indexOf", () => { const doc = (new JSDOM()).window.document; const { body } = doc; const p = doc.createElement("p"); body.appendChild(p); const div = doc.createElement("div"); body.appendChild(div); const span = doc.createElement("span"); body.appendChild(span); const index = Array.prototype.indexOf.call(body.childNodes, span); assert.equal(index, 2, "indexOf 'span' in childNodes"); }); specify("nonexistant_nodelist_indexOf", () => { const doc = (new JSDOM()).window.document; const { body } = doc; const p = doc.createElement("p"); body.appendChild(p); const div = doc.createElement("div"); p.appendChild(div); const index = Array.prototype.indexOf.call(body.childNodes, div); assert.equal(index, -1, "indexOf 'div' in childNodes"); }); specify("input_fires_click_event", () => { const doc = (new JSDOM(` `)).window.document; const checkbox = doc.getElementById("check"); checkbox.addEventListener("click", event => { assert.equal(event.type, "click", "event type"); assert.equal(event.target, checkbox, "event type"); }); checkbox.click(); }); specify("basic_radio_selected", () => { const doc = (new JSDOM(` `)).window.document; const radio0 = doc.getElementById("rad0"); const radio1 = doc.getElementById("rad1"); const radio2 = doc.getElementById("rad2"); assert.ok(!radio0.checked, "radio not checked"); assert.ok(radio1.checked, "radio checked"); assert.ok(!radio2.checked, "radio not checked"); radio2.click(); radio0.click(); assert.ok(radio0.checked, "radio checked"); assert.ok(!radio1.checked, "radio not checked"); assert.ok(radio2.checked, "radio checked"); radio1.click(); assert.ok(!radio0.checked, "radio not checked"); assert.ok(radio1.checked, "radio checked"); assert.ok(radio2.checked, "radio checked"); }); specify("radio_no_click_deselected", () => { const doc = (new JSDOM(` `)).window.document; const radio0 = doc.getElementById("rad0"); radio0.click(); assert.ok(radio0.checked, "radio checked"); radio0.click(); assert.ok(radio0.checked, "radio checked"); }); specify("select_set_value_updates_value", () => { const doc = (new JSDOM()).window.document; const { body } = doc; body.innerHTML = ` `; const select = doc.getElementById("selectElement"); select.value = "x"; assert.equal(select.value, "x", "select element value"); select.value = "y"; assert.equal(select.value, "y", "select element selectedIndex"); }); specify("select_set_value_updates_selectedIndex", () => { const doc = (new JSDOM()).window.document; const { body } = doc; body.innerHTML = ` `; const select = doc.getElementById("selectElement"); select.value = "x"; assert.equal(select.selectedIndex, 0, "select element selectedIndex"); select.value = "y"; assert.equal(select.selectedIndex, 1, "select element selectedIndex"); }); specify("select_set_value_updates_option_selected", () => { const doc = (new JSDOM()).window.document; const { body } = doc; body.innerHTML = ` `; const select = doc.getElementById("selectElement"); const option0 = doc.getElementById("optX"); const option1 = doc.getElementById("optY"); select.value = "x"; assert.ok(option0.selected, "option element selected"); select.value = "y"; assert.ok(option1.selected, "option element selected"); }); specify("select_set_selectedIndex_updates_value", () => { const doc = (new JSDOM()).window.document; const { body } = doc; body.innerHTML = ` `; const select = doc.getElementById("selectElement"); select.selectedIndex = 0; assert.equal(select.value, "x", "select element selectedIndex"); select.selectedIndex = 1; assert.equal(select.value, "y", "select element selectedIndex"); }); specify("select_set_selectedIndex_updates_selectedIndex", () => { const doc = (new JSDOM()).window.document; const { body } = doc; body.innerHTML = ` `; const select = doc.getElementById("selectElement"); select.selectedIndex = 0; assert.equal(select.selectedIndex, 0, "select element selectedIndex"); select.selectedIndex = 1; assert.equal(select.selectedIndex, 1, "select element selectedIndex"); }); specify("select_set_selectedIndex_updates_option_selected", () => { const doc = (new JSDOM()).window.document; const { body } = doc; body.innerHTML = ` `; const select = doc.getElementById("selectElement"); const option0 = doc.getElementById("optX"); const option1 = doc.getElementById("optY"); select.selectedIndex = 0; assert.ok(option0.selected, "option element selected"); assert.ok(!option1.selected, "option element selected"); select.selectedIndex = 1; assert.ok(option1.selected, "option element selected"); assert.ok(!option0.selected, "option element selected"); }); specify("select_set_option_selected_updates_value", () => { const doc = (new JSDOM()).window.document; const { body } = doc; body.innerHTML = ` `; const select = doc.getElementById("selectElement"); const option0 = doc.getElementById("optX"); const option1 = doc.getElementById("optY"); select.selectedIndex = 0; option0.selected = true; assert.equal(select.value, "x", "select element value"); option1.selected = true; assert.equal(select.value, "y", "select element value"); }); specify("select_set_option_selected_updates_selectedIndex", () => { const doc = (new JSDOM()).window.document; const { body } = doc; body.innerHTML = ` `; const select = doc.getElementById("selectElement"); const option0 = doc.getElementById("optX"); const option1 = doc.getElementById("optY"); option0.selected = true; assert.equal(select.selectedIndex, 0, "select element selectedIndex"); option1.selected = true; assert.equal(select.selectedIndex, 1, "select element selectedIndex"); }); specify("select_set_option_selected_updates_option_selected", () => { const doc = (new JSDOM()).window.document; const { body } = doc; body.innerHTML = ` `; const option0 = doc.getElementById("optX"); const option1 = doc.getElementById("optY"); option0.selected = true; assert.ok(option0.selected, "option element selected"); assert.ok(!option1.selected, "option element selected"); option1.selected = true; assert.ok(option1.selected, "option element selected"); assert.ok(!option0.selected, "option element selected"); }); }); jsdom-19.0.0/test/to-port-to-wpts/misc2.js000066400000000000000000000600461415223704400202760ustar00rootroot00000000000000"use strict"; const path = require("path"); const { assert } = require("chai"); const { describe, specify } = require("mocha-sugar-free"); const { JSDOM } = require("../.."); const toFileUrl = require("../util.js").toFileUrl(__dirname); describe("jsdom/miscellaneous", () => { specify("DOMContentLoaded should not be fired after window.close() (GH-1479)", () => { const { window } = new JSDOM(` `, { runScripts: "dangerously" }); window.close(); assert.equal(window.a, 0); }); specify("appendChild_to_document_with_existing_documentElement", () => { function t() { try { const doc = (new JSDOM()).window.document; doc.appendChild(doc.createElement("html")); } catch (e) { assert.equal(e.code, 3, "Should throw HIERARCHY_ERR"); throw e; } } assert.throws(t); }); specify("importNode", () => { assert.doesNotThrow(() => { const html1 = `

      Hello World

      `; const doc1 = (new JSDOM(html1)).window.document; const doc2 = (new JSDOM()).window.document; doc2.body.appendChild(doc2.importNode(doc1.getElementById("headline"), true)); doc2.getElementById("world").className = "foo"; }); }); specify("window_is_augmented_with_dom_features", () => { const { window } = new JSDOM(); assert.notEqual(window.Element, null, "window.Element should not be null"); }); specify("url_resolution", () => { const html = ` link1 link2 link3 link4 link5 protocol \ `; function testLocal() { const url = "file:///path/to/docroot/index.html"; const doc = (new JSDOM(html, { url })).window.document; assert.equal( doc.getElementById("link1").href, "http://example.com/", "Absolute URL should be left alone except for possible trailing slash" ); assert.equal( doc.getElementById("link2").href, "file:///local.html", "Relative URL should be resolved" ); assert.equal( doc.getElementById("link3").href, "file:///path/to/docroot/local.html", "Relative URL should be resolved" ); assert.equal( doc.getElementById("link4").href, "file:///path/local.html", "Relative URL should be resolved" ); assert.equal( doc.getElementById("link5").href, "file:///path/to/docroot/index.html#here", "Relative URL should be resolved" ); // test.equal( // doc.getElementById("link6").href, // "//prototol/avoidance.html", // "Protocol-less URL should be resolved" // ); } function testRemote() { const url = "http://example.com/path/to/docroot/index.html"; const doc = (new JSDOM(html, { url })).window.document; assert.equal( doc.getElementById("link1").href, "http://example.com/", "Absolute URL should be left alone except for possible trailing slash" ); assert.equal( doc.getElementById("link2").href, "http://example.com/local.html", "Relative URL should be resolved" ); assert.equal( doc.getElementById("link3").href, "http://example.com/path/to/docroot/local.html", "Relative URL should be resolved" ); assert.equal( doc.getElementById("link4").href, "http://example.com/path/local.html", "Relative URL should be resolved" ); assert.equal( doc.getElementById("link5").href, "http://example.com/path/to/docroot/index.html#here", "Relative URL should be resolved" ); assert.equal( doc.getElementById("link6").href, "http://example.com/protocol/avoidance.html", "Relative URL should be resolved" ); } function testBase() { const url = "about:blank"; const doc = (new JSDOM(html, { url })).window.document; const base = doc.createElement("base"); base.href = "http://example.com/path/to/docroot/index.html"; doc.getElementsByTagName("head").item(0).appendChild(base); assert.equal( doc.getElementById("link1").href, "http://example.com/", "Absolute URL should be left alone except for possible trailing slash" ); assert.equal( doc.getElementById("link2").href, "http://example.com/local.html", "Relative URL should be resolved" ); assert.equal( doc.getElementById("link3").href, "http://example.com/path/to/docroot/local.html", "Relative URL should be resolved" ); assert.equal( doc.getElementById("link4").href, "http://example.com/path/local.html", "Relative URL should be resolved" ); assert.equal( doc.getElementById("link5").href, "http://example.com/path/to/docroot/index.html#here", "Relative URL should be resolved" ); assert.equal( doc.getElementById("link6").href, "http://example.com/protocol/avoidance.html", "Relative URL should be resolved" ); } testLocal(); testRemote(); testBase(); }); specify("numeric_values", () => { const html = ` 9 `; const { document } = (new JSDOM(html)).window; const a = document.body.children.item(0); a.innerHTML = 9; a.setAttribute("id", 123); assert.strictEqual(a.innerHTML, "9", "Element stringify"); assert.strictEqual(a.getAttributeNode("id").nodeValue, "123", "Attribute stringify"); }); specify("childNodes_updates_on_insertChild", () => { const { window } = new JSDOM(); const div = window.document.createElement("div"); let text = window.document.createTextNode("bar"); div.appendChild(text); assert.strictEqual(text, div.childNodes[0], "childNodes NodeList should update after appendChild"); text = window.document.createTextNode("bar"); div.insertBefore(text, null); assert.strictEqual(text, div.childNodes[1], "childNodes NodeList should update after insertBefore"); }); specify("option_set_selected", () => { const { window } = new JSDOM(); const select = window.document.createElement("select"); const option0 = window.document.createElement("option"); select.appendChild(option0); option0.setAttribute("selected", "selected"); const optgroup = window.document.createElement("optgroup"); select.appendChild(optgroup); const option1 = window.document.createElement("option"); optgroup.appendChild(option1); assert.strictEqual(true, option0.selected, "initially selected"); assert.strictEqual(false, option1.selected, "initially not selected"); assert.strictEqual(option1, select.options[1], "options should include options inside optgroup"); option1.defaultSelected = true; assert.strictEqual(false, option0.selected, "selecting other option should deselect this"); assert.strictEqual(true, option0.defaultSelected, "default should not change"); assert.strictEqual(true, option1.selected, "selected changes when defaultSelected changes"); assert.strictEqual(true, option1.defaultSelected, "I just set this"); option0.defaultSelected = false; option0.selected = true; assert.strictEqual(true, option0.selected, "I just set this"); assert.strictEqual(false, option0.defaultSelected, "selected does not set default"); assert.strictEqual(false, option1.selected, "should deselect others"); assert.strictEqual(true, option1.defaultSelected, "unchanged"); }); specify("fix_for_issue_221", () => { const html = ""; const { document } = (new JSDOM(html)).window; const div = document.createElement("div"); document.body.appendChild(div); div.appendChild(document.createTextNode("hello world")); assert.strictEqual(div.childNodes[0].nodeValue, "hello world", "Nodelist children should be populated immediately"); }); specify("parsing_and_serializing_entities", () => { const html = `<æ☺foo`; const { document } = (new JSDOM(html)).window; const anchor = document.getElementsByTagName("a")[0]; assert.strictEqual(anchor.getAttribute("href"), "http://example.com/?a=b&c=d", "href attribute value should be deentitified"); assert.strictEqual(anchor.firstChild.nodeValue, "<æ☺foo", "nodeValue of text node should be deentitified"); assert.ok( anchor.outerHTML.indexOf("http://example.com/?a=b&c=d") !== -1, "outerHTML of anchor href should be entitified" ); assert.ok( anchor.innerHTML.indexOf("<") === 0, "innerHTML of anchor should begin with <" ); }); specify("parsing_and_serializing_unknown_entities", () => { const html = "&nowayjose;☺ lah; q;"; const { document } = (new JSDOM(html)).window; assert.strictEqual( document.body.firstChild.nodeValue, "&nowayjose;☺ lah;\tq;", "Unknown and unparsable entities should be handled like a browser would" ); assert.strictEqual( document.body.innerHTML, "&nowayjose;☺ lah;\tq;", "Unknown and unparsable entities should be handled like a browser would" ); }); specify("entities_in_script_should_be_left_alone", () => { const html = ``; const { document } = (new JSDOM(html)).window; assert.strictEqual(document.body.innerHTML, ``); assert.strictEqual(document.body.firstChild.innerHTML, `alert(""");`); }); specify("document_title_and_entities", () => { const html = "<b>Hello</b>"; const { document } = (new JSDOM(html)).window; assert.strictEqual( document.title, "Hello", `document.title should be the deentitified version of what was in the original HTML` ); document.title = "World"; assert.strictEqual( document.title, "World", `When document.title is set programmatically to something looking like HTML tags, then read again, it should ` + `have the exact same value, no entification should take place` ); document.title = "<b>World</b>"; assert.strictEqual( document.title, "<b>World</b>", `When document.title is set programmatically to something looking like HTML entities, then read again, it ` + `should have the exact same value, no deentification should take place` ); }); specify("setting_and_getting_textContent", () => { const html = `\n<foo> Hello, world!`; const { document } = (new JSDOM(html)).window; assert.strictEqual(document.textContent, null, "textContent of document should be null"); assert.strictEqual( document.head.textContent, "\n", "textContent of document.head should be the initial whitespace plus the textContent of the document title" ); assert.strictEqual( document.body.textContent, "Hello, world!", "textContent of document.body should be the concatenation of the textContent values of its child nodes" ); assert.strictEqual( document.createTextNode("<b>World</b>").textContent, "<b>World</b>", "textContent of programmatically created text node should be identical to its nodeValue" ); assert.strictEqual( document.createComment("<b>World</b>").textContent, "<b>World</b>", "textContent of programmatically created comment node should be identical to its nodeValue" ); const frag = document.createDocumentFragment(); frag.appendChild(document.createTextNode("<foo>")); frag.appendChild(document.createElement("div")).appendChild(document.createTextNode("<foo>")); assert.strictEqual( frag.textContent, "<foo><foo>", "textContent of programmatically created document fragment should be the concatenation " + "of the textContent values of its child nodes" ); const div = document.createElement("div"); div.innerHTML = "&lt;b&gt;\nWorld&lt;/b&gt;" + "&lt;b&gt;World&lt;/b&gt;"; assert.strictEqual( div.textContent, "<b>\nWorld</b><b>World</b>", `textContent of complex programmatically created
      should be the concatenation of the textContent values ` + `of its child nodes` ); }); specify("issues_230_259", () => { const instr = ``; const dom = new JSDOM(instr); assert.ok(dom.serialize().match(/0: *color/) === null); }); // see: https://github.com/jsdom/jsdom/issues/262 specify("issue_262", () => { const { document } = (new JSDOM()).window; const a = document.createElement("a"); a.setAttribute("style", "color:blue"); a.style.setProperty("color", "red"); assert.equal(a.outerHTML.match(/style="/g).length, 1, "style attribute must not be serialized twice"); }); // see: https://github.com/jsdom/jsdom/issues/267 specify("issue_267", () => { const { document } = (new JSDOM()).window; const a = document.createElement("a"); a.style.width = "100%"; assert.ok(a.getAttribute("style").match(/^\s*width\s*:\s*100%\s*;?\s*$/), "style attribute must contain width"); }); specify("get_element_by_id", () => { const doc = (new JSDOM()).window.document; const el = doc.createElement("div"); el.setAttribute("id", "foo"); assert.equal(doc.getElementById("foo"), null, "Element must not be found until it has been added to the DOM"); doc.body.appendChild(el); assert.equal(doc.getElementById("foo"), el, "Element must be found after being added"); el.id = "bar"; assert.equal(doc.getElementById("foo"), null, "Element must not be found by its previous id"); assert.equal(doc.getElementById("bar"), el, "Element must be found by its new id"); el.setAttribute("id", "baz"); assert.equal(doc.getElementById("bar"), null, "Element must not be found by its previous id"); assert.equal(doc.getElementById("baz"), el, "Element must be found by its new id"); el.getAttributeNode("id").nodeValue = "boo"; assert.equal(doc.getElementById("boo"), el, "Element must be found by its new id"); doc.body.removeChild(el); assert.equal(doc.getElementById(el.id), null, "Element must not be found after it has been removed"); }); specify("get_element_by_id_multi_id", () => { const doc = (new JSDOM()).window.document; const div = doc.createElement("div"); div.setAttribute("id", "foo"); doc.body.appendChild(div); const span = doc.createElement("span"); span.setAttribute("id", "foo"); doc.body.appendChild(span); // now if we remove the second element, we should still find the first doc.body.removeChild(span); assert.equal(doc.getElementById("foo"), div, "Original div#foo must be found after removing invalid span#foo"); }); specify("issue_335_inline_event_handlers", () => { const dom = new JSDOM(`call some function`); const a = dom.window.document.getElementsByTagName("a").item(0); const onclick = a.getAttribute("onclick"); assert.notEqual(onclick, null); assert.equal(onclick, "somefunction()"); assert.ok(dom.serialize().indexOf("onclick") > -1); }); specify("issue_338_internal_nodelist_props", () => { const doc = (new JSDOM()).window.document; const props = Object.keys(doc.body.childNodes); assert.equal(props.length, 0, "Internal properties must not be enumerable"); }); specify("setting_and_getting_script_element_text", () => { const doc = (new JSDOM("")).window.document; const script = doc.getElementsByTagName("script")[0]; assert.equal(script.text, ""); script.text = "const x = 3;"; assert.equal(script.text, "const x = 3;"); script.text = "const y = 2;"; assert.equal(script.text, "const y = 2;"); }); specify("issue_361_textarea_value_property", () => { const doc = (new JSDOM(``)).window.document; doc.getElementById("mytextarea").value = ""; assert.equal(doc.getElementById("mytextarea").value, ""); }); specify("css_classes_should_be_attached_to_dom", () => { const dom = (new JSDOM()).window; assert.notEqual(dom.StyleSheet, undefined); assert.notEqual(dom.MediaList, undefined); assert.notEqual(dom.CSSStyleSheet, undefined); assert.notEqual(dom.CSSRule, undefined); assert.notEqual(dom.CSSStyleRule, undefined); assert.notEqual(dom.CSSMediaRule, undefined); assert.notEqual(dom.CSSImportRule, undefined); assert.notEqual(dom.CSSStyleDeclaration, undefined); }); specify("issue_530_async_load_events", { async: true }, t => { const doc = (new JSDOM("")).window.document; const window = doc.defaultView; // Add the load event after the document is already created; it shouldn"t // fire until nextTick. The test will fail (with a timeout) if it has // already fired. window.addEventListener("load", () => { assert.ok(true); t.done(); }); }); specify("iframe_contents", () => { const { document } = (new JSDOM("")).window; const iframeDocument = document.querySelector("iframe").contentWindow.document; assert.equal(iframeDocument.documentElement.outerHTML, ""); assert.ok(iframeDocument.documentElement); assert.ok(iframeDocument.head); assert.ok(iframeDocument.body); }); specify("addmetatohead", () => { const dom = new JSDOM(); const { window } = dom; const meta = window.document.createElement("meta"); window.document.getElementsByTagName("head").item(0).appendChild(meta); const elements = window.document.getElementsByTagName("head").item(0).childNodes; assert.strictEqual(elements.item(elements.length - 1), meta, "last element should be the new meta tag"); assert.ok(dom.serialize().indexOf("") > -1, "meta should have open tag"); assert.strictEqual( dom.serialize().indexOf(""), -1, "meta should not be stringified with a closing tag" ); }); // these tests require file system access or they start a http server describe("node specific tests", { skipIfBrowser: true }, () => { specify("ensure_resolution_is_not_thrown_off_by_hrefless_base_tag", { async: true }, t => { const html = ` hello from html `; const { window } = new JSDOM(html, { url: toFileUrl(__filename), runScripts: "dangerously", resources: "usable" }); window.doCheck = () => { assert.equal(window.document.getElementById("test").innerHTML, "hello from javascript"); t.done(); }; }); specify("understand_file_protocol", { async: true }, t => { const html = ` hello from html `; const { window } = new JSDOM(html, { resources: "usable", runScripts: "dangerously" }); window.doCheck = () => { assert.equal( window.document.getElementById("test").innerHTML, "hello from javascript", "resource with file protocol should work" ); t.done(); }; }); specify("jquery_val_on_selects", { async: true }, t => { const { window } = new JSDOM(``, { resources: "usable", runScripts: "dangerously" }); const script = window.document.createElement("script"); script.src = "file:" + path.resolve(__dirname, "../jquery-fixtures/jquery-1.11.0.js"); script.onload = () => { window.$("body").append(``); assert.equal( window.document.querySelector("[value='first']").selected, true, "`selected` property should be `true` for first" ); assert.equal( window.document.querySelector("[value='last']").selected, false, "`selected` property should be `false` for last" ); assert.equal(window.$("[value='first']").val(), "first", "`val()` on first