diff options
Diffstat (limited to 'dom/xml/test')
38 files changed, 2246 insertions, 0 deletions
diff --git a/dom/xml/test/file_bug293347.xml b/dom/xml/test/file_bug293347.xml new file mode 100644 index 0000000000..d041450e2f --- /dev/null +++ b/dom/xml/test/file_bug293347.xml @@ -0,0 +1,2 @@ +<?xml-stylesheet type="text/xsl" href="file_bug293347xslt.xml"?> +<doc/>
\ No newline at end of file diff --git a/dom/xml/test/file_bug293347xslt.xml b/dom/xml/test/file_bug293347xslt.xml new file mode 100644 index 0000000000..44df7749e0 --- /dev/null +++ b/dom/xml/test/file_bug293347xslt.xml @@ -0,0 +1,19 @@ +<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> + <xsl:template match="/doc"> + <html> + <body> + <div></div> + <div> + <script> + didThrow = false; + try { + document.write("shrimp"); + } catch (e) { + didThrow = true; + } + </script> + </div> + </body> + </html> + </xsl:template> +</xsl:stylesheet> diff --git a/dom/xml/test/file_bug343870.xml b/dom/xml/test/file_bug343870.xml new file mode 100644 index 0000000000..cf9c60544c --- /dev/null +++ b/dom/xml/test/file_bug343870.xml @@ -0,0 +1,6 @@ +<?xml version='1.0' encoding='utf-8'?> +<html xmlns='http://www.w3.org/1999/xhtml'> +<p id='lf'> +</p><p id='cr'> +</p><p id='crlf'> +</p><p id='escapedcr'> </p></html> diff --git a/dom/xml/test/file_bug691215.xml b/dom/xml/test/file_bug691215.xml new file mode 100644 index 0000000000..37ae932348 --- /dev/null +++ b/dom/xml/test/file_bug691215.xml @@ -0,0 +1,2 @@ +<?xml version="1.0"?> +<root/> diff --git a/dom/xml/test/mochitest.toml b/dom/xml/test/mochitest.toml new file mode 100644 index 0000000000..487c4c5720 --- /dev/null +++ b/dom/xml/test/mochitest.toml @@ -0,0 +1,21 @@ +[DEFAULT] +support-files = [ + "file_bug293347.xml", + "file_bug293347xslt.xml", + "file_bug343870.xml", + "file_bug691215.xml", +] + +["test_bug232004.xhtml"] + +["test_bug293347.html"] + +["test_bug343870.xhtml"] + +["test_bug355213.xhtml"] + +["test_bug691215.html"] +skip-if = [ + "http2", + "http3", +] diff --git a/dom/xml/test/old/books/bethlehem.gif b/dom/xml/test/old/books/bethlehem.gif Binary files differnew file mode 100644 index 0000000000..db41f52fb4 --- /dev/null +++ b/dom/xml/test/old/books/bethlehem.gif diff --git a/dom/xml/test/old/books/bill.gif b/dom/xml/test/old/books/bill.gif Binary files differnew file mode 100644 index 0000000000..4b00f890cb --- /dev/null +++ b/dom/xml/test/old/books/bill.gif diff --git a/dom/xml/test/old/books/books.js b/dom/xml/test/old/books/books.js new file mode 100644 index 0000000000..8ae17d8a47 --- /dev/null +++ b/dom/xml/test/old/books/books.js @@ -0,0 +1,90 @@ +// An inefficient, but effective bubble sort +function sort(collection, key) { + var i, j; + var count = collection.length; + var parent, child; + + for (i = count - 1; i >= 0; i--) { + for (j = 1; j <= i; j++) { + if (collection[j - 1][key] > collection[j][key]) { + // Move the item both in the local array and + // in the tree + child = collection[j]; + parent = child.parentNode; + + collection[j] = collection[j - 1]; + collection[j - 1] = child; + + parent.removeChild(child); + parent.insertBefore(child, collection[j]); + } + } + } +} + +// Set user properties on the nodes in the collection +// based on information found in its children. For example, +// make a property "Author" based on the content of the +// "Author" element found in the childNode list of the node. +// This makes later sorting more efficient +function collectInfo(nodes, propNames) { + var i, j, k; + var ncount = nodes.length; + var pcount = propNames.length; + + for (i = 0; i < ncount; i++) { + var node = nodes[i]; + var childNodes = node.childNodes; + var ccount = childNodes.length; + + for (j = 0; j < ccount; j++) { + var child = childNodes[j]; + + if (child.nodeType == Node.ELEMENT_NODE) { + var tagName = child.tagName; + + for (k = 0; k < pcount; k++) { + var prop = propNames[k]; + if (prop == tagName) { + node[prop] = child.firstChild.data; + } + } + } + } + } +} + +var enabled = true; +function toggleStyleSheet() { + if (enabled) { + document.styleSheets[2].disabled = true; + } else { + document.styleSheets[2].disabled = false; + } + + enabled = !enabled; +} + +// XXX This is a workaround for a bug where +// changing the disabled state of a stylesheet can't +// be done in an event handler. For now, we do it +// in a zero-delay timeout. +function initiateToggle() { + setTimeout(toggleStyleSheet, 0); +} + +var sortableProps = ["Author", "Title", "ISBN"]; +var books = []; + +// We uppercase the tagName as a workaround for a bug +// that loses the original case of the tag. +var bookset = document.getElementsByTagName("Book"); + +// We need to create a "non-live" array to operate on. Since +// we'll be moving things around in this array, we can't use +// the read-only, live one returned by getElementsByTagName. +for (var i = 0; i < bookset.length; i++) { + books[i] = bookset[i]; +} + +collectInfo(books, sortableProps); diff --git a/dom/xml/test/old/books/books.xml b/dom/xml/test/old/books/books.xml new file mode 100644 index 0000000000..2067487d8d --- /dev/null +++ b/dom/xml/test/old/books/books.xml @@ -0,0 +1,103 @@ +<?xml version="1.0"?> +<?xml-stylesheet href="common.css" type="text/css"?> +<?xml-stylesheet href="classic.css" type="text/css"?> +<?xml-stylesheet href="list.css" type="text/css"?> + +<!DOCTYPE SearchResult> + +<SearchResult xmlns:html="http://www.w3.org/1999/xhtml" + xmlns:xlink="http://www.w3.org/1999/xlink"> + +<Header> + <Toolbar> + <html:form> + <Label>Sort by:</Label> + <html:input type="button" id="Author" onclick="sort(books,this.id)" value="Author"/> + <html:input type="button" id="Title" onclick="sort(books,this.id)" value="Title"/> + <html:input type="button" id="ISBN" onclick="sort(books,this.id)" value="ISBN #"/> + <html:input type="button" id="toggle" value="Toggle Style" onclick="initiateToggle(); return false;"/> + </html:form> + </Toolbar> + + <SearchTitle>Amazon.com Search Results for: the keywords include "Road"</SearchTitle> +</Header> + +<BookSet> + + <Book> + <BookCover><html:img src="kerouac.gif" width="100" height="140"/></BookCover> + <Title xlink:type="simple" xlink:show="replace" xlink:href="http://www.amazon.com/exec/obidos/ASIN/0140042598/002-5969498-2733628">On the Road</Title> + <Author>Kerouac, Jack</Author> + <ISBN>0140042598</ISBN> + <Synopsis> +On The Road, the most famous of Jack Kerouac's works, is not only the soul of the Beat movement and literature, but one of the most important novels of the century. Like nearly all of Kerouac's writing, On The Road is thinly fictionalized autobiography, filled with a cast made of Kerouac's real life friends, lovers, and fellow travelers. Narrated by Sal Paradise, one of Kerouac's alter-egos, On the Road is a cross-country bohemian odyssey that not only influenced writing in the years since its 1957 publication but penetrated into the deepest levels of American thought and culture. + </Synopsis> + <ListPrice>$12.95</ListPrice> + <Price>$10.36</Price> + </Book> + + <Book> + <BookCover><html:img src="bill.gif" width="100" height="140" /></BookCover> + <Title xlink:type="simple" xlink:show="replace" xlink:href="http://www.amazon.com/exec/obidos/ASIN/0140260404/002-5969498-2733628">The Road Ahead</Title> + <Author>Gates, Bill</Author> + <ISBN>666666666</ISBN> + <Synopsis> +In a study, the founder of Microsoft presents his vision for the future in which he sees the digital technologies of the coming years changing the way we buy, work, learn, and communicate. But he doesn't mention XML! + </Synopsis> + <ListPrice>$15.95</ListPrice> + <Price>$12.76</Price> + </Book> + + <Book> + <BookCover><html:img src="welville.gif" width="100" height="140" /></BookCover> + <Title xlink:type="simple" xlink:show="replace" xlink:href="http://www.amazon.com/exec/obidos/ASIN/0140167188/002-5969498-2733628">The Road to Wellville</Title> + <Author>Boyle, T. Coraghessan</Author> + <ISBN>0140167188</ISBN> + <Synopsis> +A snobbish wife and her henpecked husband travel to Dr. Kellogg's spa in turn-of-the-century Battle Creek, where the youth-crazed affluent succumb to quackery. By the author of East is East. + </Synopsis> + <ListPrice>$12.95</ListPrice> + <Price>$10.36</Price> + </Book> + + <Book> + <BookCover><html:img src="road.gif" width="100" height="140" /></BookCover> + <Title xlink:type="simple" xlink:show="replace" xlink:href="http://www.amazon.com/exec/obidos/ASIN/1562512625/002-5969498-2733628">AAA Road Atlas 1999</Title> + <Author>A. A. A.</Author> + <ISBN>1562512625</ISBN> + <Synopsis> +The definitive road atlas to the United States, Canada and Mexico. + </Synopsis> + <ListPrice>$9.95</ListPrice> + <Price>$9.95</Price> + </Book> + + <Book> + <BookCover><html:img src="bethlehem.gif" width="100" height="140" /></BookCover> + <Title xlink:type="simple" xlink:show="replace" xlink:href="http://www.amazon.com/exec/obidos/ASIN/0449219143/002-5969498-2733628">Bethlehem Road</Title> + <Author>Perry, Anne</Author> + <ISBN>0449219143</ISBN> + <Synopsis> +He might be elegant, but there's no mistaking it--the gentleman tied to the lamppost on Westminster Bridge is definitely dead. Before Inspector Thomas Pitt can even speculate on why anyone should want to kill the eminent M.P., Sir Lockwood, a colleague of his, meets the same fate at the same spot. The public is outraged, and clever Charlotte Pitt, Thomas's well-born wife, helps her hard-pressed husband by scouting society's drawing rooms for clues to these appalling crimes. Meanwhile, another victim is being stalked.... + </Synopsis> + <ListPrice>$6.99</ListPrice> + <Price>$5.59</Price> + </Book> + + <Book> + <BookCover><html:img src="charing.gif" width="100" height="140" /></BookCover> + <Title xlink:type="simple" xlink:show="replace" xlink:href="http://www.amazon.com/exec/obidos/ASIN/0140143505/002-5969498-2733628">84 Charing Cross Road</Title> + <Author>Hanff, Helene</Author> + <ISBN>0140143505</ISBN> + <Synopsis> +84, Charing Cross Road is a charming record of bibliophilia, cultural difference, and imaginative sympathy. For 20 years, an outspoken New York writer and a rather more restrained London bookseller carried on an increasingly touching correspondence... + </Synopsis> + <ListPrice>$9.95</ListPrice> + <Price>$7.96</Price> + </Book> + +</BookSet> + +<html:script src="books.js" /> + +</SearchResult> diff --git a/dom/xml/test/old/books/charing.gif b/dom/xml/test/old/books/charing.gif Binary files differnew file mode 100644 index 0000000000..9a63fb0b27 --- /dev/null +++ b/dom/xml/test/old/books/charing.gif diff --git a/dom/xml/test/old/books/classic.css b/dom/xml/test/old/books/classic.css new file mode 100644 index 0000000000..1ebc92f6e8 --- /dev/null +++ b/dom/xml/test/old/books/classic.css @@ -0,0 +1,78 @@ + + +BookSet { + display: block; +} + +Book { + float: left; + display: block; + width: 300px; + background-color: #f1f1f1; + border: 1px solid #cccccc; + margin-right: 8px; + margin-top: 8px; +} + +BookCover { + display: inline; + float: left; + margin-right: 10px; + padding: 5px; + width: 100px; + height: 140px; +} + +Title { + display: block; + font-weight: bold; + color: blue; + text-decoration: underline; + cursor: pointer; +} + +Author { + display: block; + font-style: italic; +} + +Synopsis { + display: block; + overflow: scroll; + height: 100px; + width: 155px; + padding: 3px; + background-color: #ddddff; +} + + +ListPrice { + display: block; + text-align: right; + padding-right: 15px; + text-decoration: line-through; +} + + +Price { + display: block; + color: rgb(20,100,0); + text-align:right; + padding-right: 15px; + font-weight: bold; +} + + +Price:before { + content: "Our Price: "; +} + +ISBN { + display: block; + font-family: monospace; + font-size: 8pt; +} + + + + diff --git a/dom/xml/test/old/books/common.css b/dom/xml/test/old/books/common.css new file mode 100644 index 0000000000..d63f09585d --- /dev/null +++ b/dom/xml/test/old/books/common.css @@ -0,0 +1,43 @@ +SearchResult { + display: block; + margin-top: 8px; + margin-left: 8px; +} + +Header { + width: 612px; + display: block; +} + +SearchTitle { + display: block; + width: 280px; + border-bottom: thin solid black; + padding-bottom: 6px; + margin-bottom: 12px; +} + +SearchTitle:first-line { + font-family: Verdana, Sans-Serif; + color: #cc6600; + font-size: 14pt; +} + +Toolbar { + font-family: Verdana, Sans-Serif; + float: right; + font-size: 7pt; + display: block; + border: ridge #ddddff 4px; + width: 220px; + margin-right: 0px; + text-align: center; +} + +Label { + font-weight: bold; +} + +input { + margin-top: 2px; +}
\ No newline at end of file diff --git a/dom/xml/test/old/books/kerouac.gif b/dom/xml/test/old/books/kerouac.gif Binary files differnew file mode 100644 index 0000000000..df2b371d07 --- /dev/null +++ b/dom/xml/test/old/books/kerouac.gif diff --git a/dom/xml/test/old/books/list.css b/dom/xml/test/old/books/list.css new file mode 100644 index 0000000000..3b5d408915 --- /dev/null +++ b/dom/xml/test/old/books/list.css @@ -0,0 +1,61 @@ + +BookSet { + display: block; +} + +Book { + display: list-item; + float: none; + border: none; + background: inherit; +} + +BookCover { + display: none; +} + +Title { + display: block; + font-weight: bold; + color: blue; + text-decoration: underline; + cursor: pointer; +} + +Author { + display: block; + font-style: italic; +} + +Synopsis { + display: none; +} + + +ListPrice { + display: none; + text-align: right; + padding-right: 15px; + text-decoration: line-through; +} + + +Price { + display: block; + color: rgb(20,100,0); + font-weight: bold; + text-align:left; +} + + +Price:before { + content: "Our Price: "; +} + +ISBN { + display: block; + font-family: monospace; + font-size: 8pt; +} + + diff --git a/dom/xml/test/old/books/road.gif b/dom/xml/test/old/books/road.gif Binary files differnew file mode 100644 index 0000000000..5ba7920c7e --- /dev/null +++ b/dom/xml/test/old/books/road.gif diff --git a/dom/xml/test/old/books/welville.gif b/dom/xml/test/old/books/welville.gif Binary files differnew file mode 100644 index 0000000000..7ff24a99ec --- /dev/null +++ b/dom/xml/test/old/books/welville.gif diff --git a/dom/xml/test/old/docbook.css b/dom/xml/test/old/docbook.css new file mode 100644 index 0000000000..562c8d2133 --- /dev/null +++ b/dom/xml/test/old/docbook.css @@ -0,0 +1,621 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +Book { + display: block; + padding-left: 8px; + padding-top: 8px; + font-family: Courier; + font-size: 10pt; +} + +Abbrev { + display: block; +} + +Affiliation { + font-style: italic; +} + +Appendix Title { + font-weight: bold; + font-family: Arial; + font-size: 24pt; + margin-bottom: 10pt; + display: block; +} + +Para Author { + display: inline; +} + +Author { + display: block; +} + +AuthorGroup { + font-size: 12pt; + margin-top: 25pt; + display: block; + font-weight: bold; +} + +BiblioDiv Title { + font-style: italic; +} + +Blockquote { + display: block; + margin-top: 3pt; + margin-left: 30pt; +} + +Book Title { + font-weight: bold; + font-family: Arial; + font-size: 18pt; + margin-bottom: 10pt; + display: block; +} + +BookInfo { + display: block; + margin-bottom: 30pt; +} + +BridgeHead { + display: block; + font-size: 16pt; + font-weight: bold; + color: teal; +} + +Caution { + font-weight: bold; + color: red; +} + +Caution:before { + content: "Caution:"; +} + +Chapter { + display: block; + margin-bottom: 25pt; +} + +Chapter Title { + font-weight: bold; + font-family: Arial; + font-size: 20pt; + margin-bottom: 10pt; + display: block; +} + +CiteTitle { + font-style: italic; +} + +CmdSynopsis { + display: block; +} + +CO { + display: block; +} + +Command { + font-style: italic; +} + +Comment { + display: block; +} + +ComputerOutput { + font-family: monospace; +} + +Copyright { + display: block; +} + +Para CorpAuthor { + display: inline; +} + +CorpAuthor { + display: block; +} + +Email { + font-style: italic; +} + +Editor { + display: block; +} + +Emphasis { + font-style: italic; +} + +ErrorType { + font-family: monospace; +} + +Example { + display: block; + margin-top: 10pt; + margin-bottom: 10pt; +} + +Example Title { + display: block; + font-weight: bold; + font-size: 14pt; +} + +Figure Title { + font-family: Arial; + font-size: 10pt; + font-style: italic; + font-weight: bold; + display: block; +} + +Filename { + font-style: italic; +} + +Figure { + display: block; + margin-top: 10pt; +} + +FirstTerm { + font-style: italic; +} + +ForeignPhrase { + font-style: italic; +} + +FormalPara { + display: block; +} + +FormalPara Title { + display: block; + font-weight: bold; +} + +FuncSynopsis { + display: block; +} + +FuncSynopsisInfo { + display: block; + white-space: pre; +} + +Function { + font-family: monospace; + white-space: pre; +} + +Glossary { + display: block; +} + +GlossDef { + display: block; + margin-left: 15pt; +} + +GlossList { + display: block; +} + +GlossSee { + display: block; + margin-left: 15pt; +} + +GlossTerm { + display: block; + font-weight: bold; +} + +InformalTable { + display: block; + margin-top: 10pt; + margin-bottom: 10pt; +} + +Interface { + font-family: Arial; +} + +ISBN { + display: block; + font-size: 10pt; +} + +ItemizedList { + display: block; + margin-top: 5pt; + margin-left: 20pt; +} + +LineAnnotation { + font-style: italic; +} + +Link { + color: blue; + text-decoration: underline; +} + +ListItem { + margin-left: 25pt; + display: list-item; +} + +Literal { + font-family: monospace; +} + +LiteralLayout { + white-space: pre; + display: block; +} + +Member { + display: block; + margin-left: 15pt; +} + +OLink { + display: block; + font-size: 12pt; +} + +Option { + font-family: monospace; +} + +OrderedList { + margin-top: 5pt; + margin-left: 20pt; + margin-bottom: 10pt; + display: block; + list-style-type: decimal; +} + +OrderedList Para { + display: block; + margin-top: 15pt; +} + +Para OtherCredit { + display: inline; +} + +OtherCredit { + display: block; +} + +Para { + display: block; + margin-top: 8pt; +} + +Para LiteralLayout { + display: block; + margin-top: 4pt; + margin-left: 10pt; + white-space: pre; +} + +Para Screen { + margin-top: 7pt; + margin-left: 10pt; + margin-bottom: 7pt; + display: block; +} + +Parameter { + font-family: monospace; +} + +Part Title { + font-size: 24pt; + display: block; + font-weight: bold; +} + +Preface { + display: block; + margin-top: 10pt; +} + +Procedure { + display: block; +} + +ProgramListing { + display: block; + white-space: pre; + font-family: monospace; +} + +ProgramListingCO { + display: block; + white-space: pre; + font-family: monospace; +} + +PublisherName { + font-family: Times, New, Roman; + font-size: 20pt; + margin-top: 15pt; + margin-bottom: 15pt; + display: block; +} + +RefEntry { + display: block; +} + +RefEntryTitle { + display: block; + font-size: 20pt; + font-weight: bold; +} + +RefName { + font-weight: bold; +} + +RefNameDiv { + display: block; +} + +RefSect1 { + display: block; + margin-top: 10pt; +} + +RefSect1 Title { + font-size: 14pt; +} + +RefSect1Info { + display: block; + font-size: small; +} + +RefSect2 { + display: block; + margin-top: 10pt; +} + +RefSect2 Title { + font-size: 14pt; +} + +RefSect2Info { + display: block; + font-size: small; +} + +RefSect3 { + display: block; + margin-top: 10pt; +} + +RefSect3 Title { + font-size: 14pt; +} + +RefSect3Info { + display: block; + font-size: small; +} + +RefSynopsisDiv { + display: block; + margin-top: 15pt; +} + +RefSynopsisDiv Title { + display: block; + font-size: 18pt; +} + +Replaceable { + font-family: Arial; + font-style: italic; +} + +Screen { + display: block; + margin-left: 20pt; + margin-bottom: 10pt; + white-space: pre; +} + +ScreenCO { + white-space: pre; +} + +ScreenShot { + white-space: pre; +} + +Sect1 { + display: block; + margin-top: 16pt; +} + +Sect1 Title { + font-family: Arial; + font-size: 20pt; + font-weight: bold; + display: block; +} + +Sect2 { + display: block; + margin-top: 15pt; +} + +Sect2 Title { + font-family: Arial; + font-size: 14pt; + font-weight: bold; + display: block; +} + +Sect3 { + display: block; + margin-top: 15pt; +} + +Sect3 Title { + font-family: Arial; + font-size: 14pt; + font-weight: bold; + display: block; +} + +SegListItem { + display: block; +} + +SegmentedList { + display: block; +} + +SegmentedList Title { + display: block; + font-weight: bold; +} + +Sidebar { + display: block; + margin-top: 15pt; + margin-left: 30pt; + font-family: Arial; + font-size: 9pt; +} + +Step { + display: block; +} + +Step Title { + display: block; + font-style: italic; +} + +Subscript { + font-size: 5pt; + vertical-align: sub; +} + +Subtitle { + font-family: Arial; + font-size: 20pt; + font-weight: bold; + display: block; + text-align: center; +} + +Superscript { + font-size: 5pt; + vertical-align: super; +} + +Synopsis { + display: block; + white-space: pre; +} + +SystemItem { + font-family: monospace; +} + +Table { + display: block; + margin-top: 10pt; +} + +Table Title { + font-family: Arial; + font-size: 10pt; + font-style: italic; + font-weight: bold; +} + +Term { + font-weight: bold; +} + +Title { + font-family: Arial; + font-size: 20pt; + font-weight: bold; + display: block; + text-align: center; +} + +TitleAbbrev { + font-family: Arial; + font-size: 14pt; + font-weight: bold; + display: block; +} + +ULink { + color: blue; + text-decoration: underline; + cursor: pointer; +} + +UserInput { + font-family: monospace; + font-weight: bold; +} + +VariableList Title { + font-weight: bold; + display: block; +} + +VarListEntry { + display: block; + margin-top: 10pt; +} + +VarListEntry Term { + display: block; + font-style: italic; +} + +Warning { + font-weight: bold; + color: fuchsia; +} + +Warning:before { + content: "Warning:"; +} + + +Year { + font-family: serif; + font-weight: bold; +} diff --git a/dom/xml/test/old/docbooktest.xml b/dom/xml/test/old/docbooktest.xml new file mode 100644 index 0000000000..d47c3cb12e --- /dev/null +++ b/dom/xml/test/old/docbooktest.xml @@ -0,0 +1,126 @@ +<?xml version="1.0"?> +<?xml-stylesheet href="docbook.css" type="text/css"?> +<!DOCTYPE Book SYSTEM "docbook.dtd"> +<Book xmlns:xlink="http://www.w3.org/1999/xlink"> +<Title>SoftQuad +Inc.</Title> +<p xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://www.w3.org/1999/xhtml"> +<h:img src="flamer.gif"/> +<img src="flamer.gif"/> +<button><b>some text</b></button> +</p> +<BookInfo> <BookBiblio> <Title>Demo Product Documentation</Title> +<AuthorGroup><CorpAuthor>SoftQuad Inc.</CorpAuthor></AuthorGroup> +</BookBiblio> </BookInfo> <Preface> <Title><Anchor +Id="SDK3"/>Element Overview</Title> +<BridgeHead>Introduction to Elements</BridgeHead> +<Para>By far the vast majority of objects (apart from text) that authors +encounter when traversing a document are Element nodes. </Para> </Preface> +<Part> <Title><Anchor Id="SDK273"/>Element Interfaces</Title> +<Chapter Label="1"> <Title><Anchor Id="SDK274"/>Elements and +Attributes</Title> +<Sect1> <Title><Anchor Id="SDK279"/>Introduction to Attributes +</Title> +<Para>Elements may have attributes associated with them; since the Element +interface inherits from Node, the generic Node interface method +<Function>getAttributes</Function> may be used to retrieve the set of all +attributes for an element. </Para> +<Para>There are methods on the Element interface to retrieve either an Attr +object by name or an attribute value by name. In XML, where an attribute value +may contain entity references, an Attr object should be retrieved to examine +the possibly fairly complex sub-tree representing the attribute value. On the +other hand, in HTML, where all attributes have simple string values, methods to +directly access an attribute value can safely be used as a convenience. </Para> + +<Para>Before you can access an Attribute, you must first gain access to the +associated Element.</Para> </Sect1> +<Sect1> <Title><Anchor Id="SDK378"/>Setting the Attribute +Values</Title> +<Para>Attr objects inherit the Node interface, but since they are not actually +child nodes of the element they describe, the DOM does not consider them part +of the document tree. Thus, the Node attributes parentNode, previousSibling, +and nextSibling have a null value for Attr objects. The DOM takes the view that +attributes are properties of elements rather than having a separate identity +from the elements they are associated with; this should make it more efficient +to implement such features as default attributes associated with all elements +of a given type. Furthermore, Attr nodes may not be immediate children of a +DocumentFragment. However, they can be associated with Element nodes contained +within a DocumentFragment. In short, users and implementors of the DOM need to +be aware that Attr nodes have some things in common with other objects +inheriting the Node interface, but they also are quite distinct. </Para> +<Para>The attribute's effective value is determined as follows:</Para> +<ItemizedList Mark="Bullet"> <ListItem> +<Para>If this attribute has been explicitly assigned any value, that value is +the attribute's effective value</Para></ListItem> <ListItem> +<Para>Otherwise, if there is a declaration for this attribute, and that +declaration includes a default value, then that default value is the +attribute's effective value</Para></ListItem> <ListItem> +<Para>Otherwise, the attribute does not exist on this element in the structure +model until it has been explicitly added.</Para></ListItem> </ItemizedList> +<Para>In XML, where the value of an attribute can contain entity references, +the child nodes of the Attr node provide a representation in which entity +references are not expanded. These child nodes may be either Text or +EntityReference nodes. Because the attribute type may be unknown, there are no +tokenized attribute values. </Para> +<Para>The following topics describe DOM attributes: </Para> +<ItemizedList Mark="Bullet"> <ListItem> +<Para> +<ULink xlink:type="simple" xlink:show="replace" + xlink:href="http://www.w3.org/TR/REC-DOM-Level-1/level-one-core.html#ID-637646024">Interface +Attr</ULink> </Para></ListItem> <ListItem> +<Para> +<ULink xlink:type="simple" xlink:show="new" + xlink:href="http://www.w3.org/TR/REC-DOM-Level-1/level-one-core.html#ID-745549614"> +Interface Element</ULink> </Para></ListItem> </ItemizedList> </Sect1></Chapter> + +<Chapter Label="26" Role="funcref"> <Title><Anchor +Id="SDK48"/>DOM Level 1 Core: Element Functions</Title> +<RefEntry> <RefMeta><RefEntryTitle> <Anchor Id="setAttribute"/>setAttribute +</RefEntryTitle></RefMeta> <RefNameDiv> <RefName>setAttribute</RefName> +<RefPurpose>Sets the Attributes on the associated Element object</RefPurpose> +<RefClass>Fundamental</RefClass> </RefNameDiv> <RefSynopsisDiv> <Title> +<Anchor Id="SDK85"/>Syntax</Title> +<RefSect2> <Title>OMG IDL</Title> +<Synopsis><Type>void</Type> <Function>setAttribute</Function> (in +<Type>DOMString</Type> <Parameter>name</Parameter>, in <Type>DOMString</Type> +<Parameter>value</Parameter>) raises (<ErrorType>DOMException</ErrorType>); +</Synopsis></RefSect2><RefSect2> <Title><Anchor Id="SDK86"/>Java</Title> +<Synopsis><Type>public void</Type> <Function>setAttribute</Function> ( +<Type>String</Type> <Parameter>name</Parameter>, <Type>String</Type> +<Parameter>value</Parameter>) throws (<ErrorType>DOMException</ErrorType>); +</Synopsis> </RefSect2><RefSect2> <Title><Anchor Id="SDK87"/>ECMA Script +</Title> +<Synopsis> <Function>setAttribute</Function> (<Parameter>name, value +</Parameter>)</Synopsis> </RefSect2></RefSynopsisDiv><RefSect1> <Title> +<Anchor Id="SDK88"/>Parameters</Title> +<VariableList> <VarListEntry><Term> <Parameter>name</Parameter></Term> +<ListItem> +<Para>(IN) The name of the attribute to create or alter.</Para> </ListItem> +</VarListEntry><VarListEntry><Term> <Parameter>value</Parameter></Term> +<ListItem> +<Para>(IN) Value to set in string form</Para> </ListItem></VarListEntry> +</VariableList></RefSect1><RefSect1> <Title><Anchor Id="SDK89"/>Exceptions +</Title> +<Para>These are the applicable exceptions. </Para> <InformalTable> <TGroup cols="2"> +<colspec colname="1" colnum="1" colwidth="0.630in"/> +<colspec colname="2" colnum="2" colwidth="5.203in"/> <tbody> +<row> <entry colname="1"> +<Para>INVALID_CHARACTER_ERR</Para></entry> <entry colname="2"> +<Para>Raised if the specified name contains an invalid character.</Para> +</entry></row> <row> <entry colname="1"> +<Para> NO_MODIFICATION_ALLOWED_ERR</Para></entry> <entry colname="2"> +<Para>Raised if this node is readonly.</Para></entry> </row> +</tbody> +</TGroup></InformalTable></RefSect1><RefSect1> <Title><Anchor +Id="SDK90"/>Remarks</Title> +<Para> <Function>setAttribute</Function> adds a new attribute. If an attribute +with that name is already present in the element, its value is changed to be +that of the value parameter. This value is a simple string, it is not parsed as +it is being set. So any markup (such as syntax to be recognized as an entity +reference) is treated as literal text, and needs to be appropriately escaped by +the implementation when it is written out.</Para> +<Para> In order to assign an attribute value that contains entity references, +the user must create an Attr node plus any Text and EntityReference nodes, +build the appropriate subtree, and use <Function>setAttributeNode</Function> to +assign it as the value of an attribute. </Para> </RefSect1></RefEntry> +</Chapter></Part></Book> diff --git a/dom/xml/test/old/flamer.gif b/dom/xml/test/old/flamer.gif Binary files differnew file mode 100644 index 0000000000..5a05df583f --- /dev/null +++ b/dom/xml/test/old/flamer.gif diff --git a/dom/xml/test/old/script.xml b/dom/xml/test/old/script.xml new file mode 100644 index 0000000000..f21d30d973 --- /dev/null +++ b/dom/xml/test/old/script.xml @@ -0,0 +1,67 @@ +<?xml version="1.0"?> +<?xml-stylesheet href="docbook.css" type="text/css"?> +<!DOCTYPE Book System "file:///E|/Program%20Files/SoftQuad/XMetaL/Rules/docbook.dtd"> +<Book xmlns:html="http://www.w3.org/1999/xhtml"> + <Title>The Book</Title> + <Chapter> + <Title>Chapter 1.</Title> + <Para>Yada yada <html:img src="mzcolor.gif"/> yada.</Para> + </Chapter> + <html:script> +<![CDATA[ +function list(node) +{ + var type = node.nodeType; + if (type == Node.ELEMENT_NODE) { + + // open tag + dump("\<" + node.tagName); + + // dump the attributes if any + attributes = node.attributes; + if (null != attributes) { + var countAttrs = attributes.length; + var index = 0; + while(index < countAttrs) { + att = attributes[index]; + if (null != att) { + dump(" " + att.name + "=" + att.value); + } + index++; + } + } + + // recursively dump the children + if (node.hasChildNodes()) { + // close tag + dump(">"); + + // get the children + var children = node.childNodes; + var length = children.length; + var count = 0; + while(count < length) { + child = children[count]; + list(child); + count++; + } + dump("</" + node.tagName + ">"); + } + else { + // close tag + dump("/>"); + } + + + } + // if it's a piece of text just dump the text + else if (type == Node.TEXT_NODE) { + dump(node.data); + } +} + +list(document.documentElement); +dump("\n"); +]]> + </html:script> +</Book> diff --git a/dom/xml/test/old/simple.xml b/dom/xml/test/old/simple.xml new file mode 100644 index 0000000000..c94708c665 --- /dev/null +++ b/dom/xml/test/old/simple.xml @@ -0,0 +1,10 @@ +<?xml version="1.0"?> +<?xml-stylesheet href="docbook.css" type="text/css"?> +<!DOCTYPE Book SYSTEM "file:///E|/Program%20Files/SoftQuad/XMetaL/Rules/docbook.dtd"> +<Book xmlns:html="http://www.w3.org/1999/xhtml"> + <Title>The Book</Title> + <Chapter> + <Title>Chapter 1.</Title> + <Para>Yada yada <html:img src="mzcolor.gif"/> yada.</Para> + </Chapter> +</Book> diff --git a/dom/xml/test/old/toc/book.css b/dom/xml/test/old/toc/book.css new file mode 100644 index 0000000000..778c4244c2 --- /dev/null +++ b/dom/xml/test/old/toc/book.css @@ -0,0 +1,137 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +/* The book style must be the first style for our JavaScript to work */ +book { + display: block; + padding-left: 2em; + padding-right: 2em; + padding-top: 8px; + font-size: 12pt; + background-color: lightyellow; + font-family: Arial; +} + +book title { + font-weight: bold; + font-size: 24pt; + display: block; + text-align: center; + margin-top: 12pt; + margin-bottom: 3pt; +} + +book subtitle { + display: block; + font-size:12pt; + text-align: center; +} + +book abstract { + display: block; + margin-top: 3pt; +} + +input { + display: block; + margin-left: auto; + margin-right: auto; +} + +chapter { + display: block; +} + +chapter title { + font-weight: bold; + font-size: 16pt; + display: block; + text-align: left; + margin-top: 12pt; + margin-bottom: 3pt; +} + +section { + display: block; +} + +section title { + display: block; + font-size: 10pt; + text-align: left; + margin-top: 12pt; + margin-bottom: 3pt; +} + +contents { + display: block; +} + +para { + display: block; + margin-bottom: auto; + margin-top: auto; + font-size:11pt; +} + +link { + display: inline; + color: blue; + text-decoration: underline; + cursor: pointer; +} + +list { + display: block; + margin-right: 0; + margin-bottom: auto; + margin-top: auto; + list-style-type: disc; + margin-left: 40px; +} + +listitem { + display: list-item; + list-style-position: inside; +} + +emph { + font-style: italic; + font-weight: bold; +} + +ref { + font-style: italic; +} + +heading { + font-weight: bold; +} + +navbar { + font-family: Arial; + font-size: 10pt; + display: block; + float: right; + background-color: #CCE6F3; + color: darkblue; + width: 10em; + margin-right: 0.5em; +} + +navbar title { + font-size: 10pt; + display: block; + background-color: black; + color: white; + margin-bottom:0px; +} + +navbar content { + display: block; + padding: 0.3em; + border: 1px solid black; + font-size: 9pt; +} + diff --git a/dom/xml/test/old/toc/irslogo.gif b/dom/xml/test/old/toc/irslogo.gif Binary files differnew file mode 100644 index 0000000000..daab0ca3ab --- /dev/null +++ b/dom/xml/test/old/toc/irslogo.gif diff --git a/dom/xml/test/old/toc/minus.gif b/dom/xml/test/old/toc/minus.gif Binary files differnew file mode 100644 index 0000000000..8adf8d6add --- /dev/null +++ b/dom/xml/test/old/toc/minus.gif diff --git a/dom/xml/test/old/toc/plus.gif b/dom/xml/test/old/toc/plus.gif Binary files differnew file mode 100644 index 0000000000..55446e34c9 --- /dev/null +++ b/dom/xml/test/old/toc/plus.gif diff --git a/dom/xml/test/old/toc/rights.xml b/dom/xml/test/old/toc/rights.xml new file mode 100644 index 0000000000..520eef3de1 --- /dev/null +++ b/dom/xml/test/old/toc/rights.xml @@ -0,0 +1,292 @@ +<?xml version="1.0"?> +<!-- Our script expects the book.css stylesheet first --> +<?xml-stylesheet href="book.css" type="text/css"?> +<?xml-stylesheet href="toc.css" type="text/css"?> +<!DOCTYPE book [ +<!ATTLIST book id ID #IMPLIED> +<!ATTLIST chapter id ID #IMPLIED> +<!ATTLIST section id ID #IMPLIED> +]> +<book id="book" xmlns:html="http://www.w3.org/1999/xhtml" + xmlns:xlink="http://www.w3.org/1999/xlink"> + <html:a name="book"/> + <html:script src="toc.js"/> + <html:img src="irslogo.gif"/> + <navbar> + <title>Table of contents</title> + <content> + To toggle the Table of Contents, click on this button + <html:input type="button" value="Contents" onclick="createToc();"/> + </content> + </navbar> + + <title>Highlights of 1999 Tax Changes</title> + <subtitle>(Rev. December 1999)</subtitle> + + <chapter id="chap1"> + <html:a name="chap1"/> + <title>Tax Changes for Individuals</title> + <contents> + <section id="chap1sec1"> + <html:a name="chap1sec1"/> + <title>Child Tax Credit Increased</title> + <contents> + <para> +The maximum child tax credit for each qualifying child will increase from $400 to $500 in 1999. + </para> + </contents> + </section> + <section id="chap1sec2"> + <html:a name="chap1sec2"/> + <title>Standard Mileage Rate</title> + <contents> + <para> +Beginning April 1, 1999, the optional standard mileage rate for operating your carfor business decreases to 31 cents a mile for each business mile. Until then, the business standard mileage rate of 32 1/2 cents per mile that was in effect for 1998 will continue to apply. + </para> + </contents> + </section> + <section id="chap1sec3"> + <html:a name="chap1sec3"/> + <title>Estimated Tax Safe Harbor for Higher Income Individuals</title> + <contents> + <para> +For estimated tax payments for tax years beginning in 1999, the safe harbor for higher income individuals (other than farmers and fishermen) has been modified. If your 1998 adjusted gross income was more than $150,000 ($75,000 if you aremarried filing a separate return for 1999), you will have to pay the smaller of 90% of your expected tax for 1999 or 105% (up from 100%) of the tax shown on your 1998 return (provided your 1998 return covered all 12 months) to avoid an estimated tax penalty. + </para> + <para> +For more information on estimated tax, see + <link xlink:type="simple" xlink:href="http://www.irs.ustreas.gov/prod/forms_pubs/pubs/p505toc.htm" xlink:show="replace" xlink:actuate="user">Publication 505</link>. + </para> + </contents> + </section> + <section id="chap1sec4"> + <html:a name="chap1sec4"/> + <title>Self-Employed Health Insurance Deduction</title> + <contents> + <para> +For 1999, the health insurance deduction for the self-employed is increased from 45% to 60% of the amount you pay for medical insurance for yourself and your family. For more information, see chapter 10 in + <link xlink:type="simple" xlink:href="http://www.irs.ustreas.gov/prod/forms_pubs/pubs/p535toc.htm" xlink:show="replace" xlink:actuate="user">Publication 535</link>. + </para> + </contents> + </section> + <section id="chap1sec5"> + <html:a name="chap1sec5"/> + <title>Social Security and Medicare Taxes</title> + <contents> + <para> +For 1999, the employer and employee will continue to pay: + <list> + <listitem> +1.6.2% each for social security tax (old-age, survivors, and disability insurance), and + </listitem> + <listitem> +2.1.45% each for Medicare tax (hospital insurance). + </listitem> + </list> + </para> + <para> + <heading>Wage limits.</heading> +For social security tax, the maximum amount of 1999 wages subject to the tax has increased to $72,600. For Medicare tax, all covered 1999 wages are subject to the tax. There is no wage base limit. For information about these taxes, see + <link xlink:type="simple" xlink:href="http://www.irs.ustreas.gov/prod/forms_pubs/pubs/p15toc.htm" xlink:show="replace" xlink:actuate="user">Publication 15</link>, <ref>Circular E, Employer's Tax Guide</ref>. + </para> + </contents> + </section> + <section id="chap1sec6"> + <html:a name="chap1sec6"/> + <title>Self-Employment Tax</title> + <contents> + <para> +The self-employment tax rate on net earnings remains the same for calendar year1999. This rate, 15.3%, is a total of 12.4% for social security (old-age, survivors, and disability insurance), and 2.9% for Medicare (hospital insurance). + </para> + <para> +The maximum amount subject to the social security part for tax years beginning in 1999 has increased to $72,600. All net earnings of at least $400 are subject to the Medicare part. + </para> + </contents> + </section> + </contents> + </chapter> + + <chapter id="chap2"> + <html:a name="chap2"/> + <title>Tax Changes for Businesses</title> + <contents> + <section id="chap2sec1"> + <html:a name="chap2sec1"/> + <title>Social Security and Medicare Taxes</title> + <contents> + <para> +For 1999, the employer and employee will continue to pay: + <list> + <listitem> +6.2% each for social security tax (old-age, survivors, and disability insurance), and + </listitem> + <listitem> +1.45% each for Medicare tax (hospital insurance). + </listitem> + </list> + </para> + <para> +<heading>Wage limits.</heading> For social security tax, the maximum amount of 1999 wages subject to the tax has increased to $72,600. For Medicare tax, all covered 1999 wages are subject to the tax. There is no wage base limit. For information about these taxes and amounts to withhold, see +<link xlink:type="simple" xlink:href="http://www.irs.ustreas.gov/prod/forms_pubs/pubs/p15toc.htm" xlink:show="replace" xlink:actuate="user">Publication 15</link>, <ref>Circular E, Employer's TaxGuide</ref>. + </para> + </contents> + </section> + <section id="chap2sec2"> + <html:a name="chap2sec2"/> + <title>Employment Tax Deposits</title> + <contents> + <para> +Under certain circumstances, the IRS can waive the penalty for a first-time depositor's inadvertent failure to timely deposit employment taxes. For deposits required to be made after January 18, 1999, this waiver is expanded to include the first deposit required to be made after a required change in frequency of a taxpayer's deposits. + </para> + </contents> + </section> + <section id="chap2sec3"> + <html:a name="chap2sec3"/> + <title>Electronic Deposit of Taxes</title> + <contents> + <para> +If you were first required to deposit taxes by electronic funds transfer after June 30, 1997, the IRS will not impose the penalty for not doing so before July 1, 1999. Previously, the IRS had waived the penalty through December 31, 1998. For information about depositing taxes electronically, see <link xlink:type="simple" xlink:href="http://www.irs.ustreas.gov/prod/forms_pubs/pubs/p15toc.htm" xlink:show="replace" xlink:actuate="user">Publication 15</link>. + </para> + </contents> + </section> + <section id="chap2sec4"> + <html:a name="chap2sec4"/> + <title>941 TeleFile</title> + <contents> + <para> +Beginning with the first quarter of 1998, many employers were able to file Form941 by phone, toll free. If you receive 941 TeleFile with your Form 941 package, check page TEL-1 of the <ref>941 TeleFile Instructions</ref> to see if you qualify for this quick, convenient, and easy method of filing. + </para> + </contents> + </section> + <section id="chap2sec5"> + <html:a name="chap2sec5"/> + <title>941 On-Line</title> + <contents> + <para> +In 1998, a limited number of employers were allowed to file Form 941 using commercially available software to create the return and then transmitting the return electronically to IRS through a third party. 941 On-Line uses Electronic Data Interchange (EDI) format. In 1999, IRS expects to make the 941 On-Line filing option available nationwide. + </para> + </contents> + </section> + <section id="chap2sec6"> + <html:a name="chap2sec6"/> + <title>Self-Employment Tax </title> + <contents> + <para> +The self-employment tax rate on net earnings remains the same for calendar year 1999. This rate, 15.3%, is a total of 12.4% for social security (old-age, survivors,and disability insurance), and 2.9% for Medicare (hospital insurance). + </para> + <para> +The maximum amount subject to the social security part for tax years beginning in 1999 has increased to $72,600. All net earnings of at least $400 are subject to the Medicare part. + </para> + </contents> + </section> + </contents> + </chapter> + + <chapter id="chap3"> + <html:a name="chap3"/> + <title>IRA and other Retirement Plans</title> + <contents> + <section id="chap3sec1"> + <html:a name="chap3sec1"/> + <title>Hardship Distributions</title> + <contents> + <para> +Beginning in 1999, hardship distributions from 401(k) plans and 403(b) plans are not eligible rollover distributions. They cannot be rolled over into a traditional IRA. For more information on traditional IRAs, see <link xlink:type="simple" xlink:href="http://www.irs.ustreas.gov/prod/forms_pubs/pubs/p590toc.htm" xlink:show="replace" xlink:actuate="user">Publication 590</link>. + </para> + </contents> + </section> + </contents> + </chapter> + + <chapter id="chap4"> + <html:a name="chap4"/> + <title>Gift and Estate Taxes</title> + <contents> + <section id="chap4sec1"> + <html:a name="chap4sec1"/> + <title>New Deduction From Gross Estate</title> + <contents> + <para> +For estates of decedents dying after 1997, the executor can elect to deduct the adjusted value of a qualified family-owned business interest, up to a limited amount, from the gross estate. For more information, see section 2057 of the Internal Revenue Code and the instructions for Schedule T, Form 706, <ref>United States Estate (and Generation-Skipping Transfer) Tax Return</ref>. + </para> + </contents> + </section> + <section id="chap4sec2"> + <html:a name="chap4sec2"/> + <title>Suit for Refund</title> + <contents> + <para> +Effective July 23, 1998, an executor no longer needs to wait until all the installment payments have been made before filing a suit for refund with a federal district court or the U.S. Court of Federal Claims if the following conditions are met. + <list> + <listitem> +The estate consists largely of an interest in a closely-held business. + </listitem> + <listitem> +The estate elected to make tax payments through the installment method. + </listitem> + </list> + </para> + <para> +However, all of the following must be true before a suit can be filed. + <list> + <listitem> +All installment payments due on or before the date the suit is filed have been made. + </listitem> + <listitem> +No accelerated installment payments have been made. + </listitem> + <listitem> +No Tax Court case is pending with respect to any estate tax liability. + </listitem> + <listitem> +The time for petitioning the Tax Court has passed if a notice of deficiency was issued to the estate regarding its liability for estate tax. + </listitem> + <listitem> +No proceeding is pending for a declaratory judgment by the Tax Court on whether the estate is eligible to pay tax in installments. + </listitem> + </list> + </para> + <para> +In addition, the executor must <emph>not</emph>: + <list> + <listitem> +Include any previously litigated issues in the current suit for refund, and + </listitem> + <listitem> +Discontinue making timely installment payments while the court considers the suit for refund. + </listitem> + </list> + </para> + </contents> + </section> + </contents> + </chapter> + + <chapter id="chap5"> + <html:a name="chap5"/> + <title>Excise Tax</title> + <contents> + <section id="chap5sec1"> + <html:a name="chap5sec1"/> + <title>Air Transportation Taxes</title> + <contents> + <para> +For 1999, the tax on the use of international air travel facilities will be $12.20 for both arrivals and departures. In the case of air transportation between the continental United States and Alaska or between Alaska and Hawaii, the use-of-international-facilities tax on departures will be $6.10. + </para> + </contents> + </section> + <section id="chap5sec2"> + <html:a name="chap5sec2"/> + <title>Luxury Tax</title> + <contents> + <para> +For 1999, the luxury tax on a passenger vehicle is reduced from 7% to 6% of the amount of the sales price that exceeds the base amount. The base amount for 1999 is $36,000. + </para> + <para> +The base amount is increased for electric vehicles and clean-fuel vehicles. See <link xlink:type="simple" xlink:href="http://www.irs.ustreas.gov/prod/forms_pubs/pubs/p510toc.htm" xlink:show="replace" xlink:actuate="user">Publication 510</link> for information on these amounts. + </para> + </contents> + </section> + </contents> + </chapter> + +</book> diff --git a/dom/xml/test/old/toc/toc.css b/dom/xml/test/old/toc/toc.css new file mode 100644 index 0000000000..99c0c9d327 --- /dev/null +++ b/dom/xml/test/old/toc/toc.css @@ -0,0 +1,77 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +toc { + position:fixed; + top:0; + left:0; + width:12em; + height:100%; + border-right: 1px solid black; + background-color: #CCE6F3; + font-family: Arial; + overflow:auto; + color: darkblue; +} + +toc > title { + display: block; + font-size:12pt; + font-weight: bold; + background-color: black; + color:white; +} + +toclink:visited { + color: purple; +} + +toclink:active { + color: red; +} + +level1 { + display: block; + font-weight:bold; + font-size:12pt; + margin-left: 4px; + margin-bottom: 2px; +} + +level1 > toclink { + list-style-position: inside; + text-decoration: none; + color: darkblue; +} + +level2 { + display: block; + font-size:11pt; + margin-left: 8px; + margin-bottom: 2px; +} + +level2 > toclink { + list-style-position: inside; + text-decoration: none; + color: darkblue; +} + +level3 { + display: list-item; + font-size: 8pt; + margin-left: 12px; + margin-bottom: 2px; +} + +level3 > toclink { + list-style-position: inside; + text-decoration: none; + color: darkblue; +} + +toc img { + margin-right: 1em; +} + diff --git a/dom/xml/test/old/toc/toc.js b/dom/xml/test/old/toc/toc.js new file mode 100644 index 0000000000..f30ffd6cff --- /dev/null +++ b/dom/xml/test/old/toc/toc.js @@ -0,0 +1,131 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +// Event handler for display togglers in Table of Contents +function toggleDisplay(event) { + if (event.target.localName != "img") { + return; + } + var img = event.target; + var div = img.nextSibling.nextSibling; + + // Change the display: property of the container to + // hide and show the container. + if (div.style.display == "none") { + div.style.display = "block"; + img.src = "minus.gif"; + } else { + div.style.display = "none"; + img.src = "plus.gif"; + } +} + +// Function that recurses down the tree, looking for +// structural elements. For each structural element, +// a corresponding element is created in the table of +// contents. +var searchTags = ["book", "chapter", "section"]; +var tocTags = ["level1", "level2", "level3"]; +function addToToc(root, tocFrame) { + var i; + var newTocFrame = tocFrame; + var newTocElement = null; + var newTocLink = null; + + for (i = 0; i < searchTags.length; i++) { + if (root.tagName == searchTags[i]) { + // If we've found a structural element, create the + // equivalent TOC element. + newTocElement = document.createElement(tocTags[i]); + // Create the toclink element that is a link to the + // corresponding structural element. + newTocLink = document.createElement("toclink"); + newTocLink.setAttributeNS( + "http://www.w3.org/1999/xlink", + "xlink:type", + "simple" + ); + newTocLink.setAttributeNS( + "http://www.w3.org/1999/xlink", + "xlink:href", + "#" + root.getAttribute("id") + ); + newTocLink.setAttributeNS( + "http://www.w3.org/1999/xlink", + "xlink:show", + "replace" + ); + newTocElement.appendChild(newTocLink); + + // Create the image and toggling container in the table of contents + if (i < searchTags.length - 1) { + var img = document.createElementNS( + "http://www.w3.org/1999/xhtml", + "img" + ); + img.src = "minus.gif"; + newTocElement.insertBefore(img, newTocLink); + + newTocFrame = document.createElementNS( + "http://www.w3.org/1999/xhtml", + "div" + ); + newTocElement.appendChild(newTocFrame); + } else { + newTocFrame = null; + } + + tocFrame.appendChild(newTocElement); + + break; + } + } + + // Recurse down through the childNodes list + for (i = 0; i < root.childNodes.length; i++) { + var child = root.childNodes[i]; + if (child.nodeType == Node.ELEMENT_NODE) { + if (newTocLink != null && child.tagName == "title") { + var text = child.firstChild.cloneNode(true); + newTocLink.appendChild(text); + } else { + addToToc(child, newTocFrame); + } + } + } +} + +// Create the root table of contents element (a fixed element) +// and its contents. +function createToc() { + if (!document.getElementsByTagName("toc").length) { + var toc = document.createElement("toc"); + var title = document.createElement("title"); + title.appendChild(document.createTextNode("Table of Contents")); + toc.appendChild(title); + + // Recurse down and build up the document element + addToToc(document.documentElement, toc); + + // Since we've created the toc element as a fixed element, + // insert a rule that shifts over the document element by + // the width of the toc element. + document.styleSheets[0].cssRules[0].style.marginLeft = "12em"; + document.documentElement.appendChild(toc); + + // Attach the event handler for table of contents buttons. + // This will only work for content that is already a part + // of a document, which is why we had to wait until here + // to do this. + toc.addEventListener("mouseup", toggleDisplay, 1); + } else { + // Hide the table of contents. + // This is not very intelligent if we have a static document, we should + // just hide/show the toc via stylesheet mungling + document.documentElement.removeChild( + document.getElementsByTagName("toc")[0] + ); + document.styleSheets[0].cssRules[0].style.marginLeft = "0em"; + } +} diff --git a/dom/xml/test/old/xlink/auto.xml b/dom/xml/test/old/xlink/auto.xml new file mode 100644 index 0000000000..91eb15ff43 --- /dev/null +++ b/dom/xml/test/old/xlink/auto.xml @@ -0,0 +1,16 @@ +<?xml version="1.0"?> +<?xml-stylesheet href="link.css" type="text/css"?> +<root xmlns:xlink="http://www.w3.org/1999/xlink"> + <p>Testing simple XLinks that must fire immediately on load.</p> + <mylink xlink:type="simple" xlink:actuate="onLoad" xlink:show="new" xlink:href="resource:/res/samples/test0.html"> +Must not open automatically, illegal</mylink> + <mylink xlink:type="simple" xlink:actuate="onLoad" xlink:show="new" xlink:href="http://www.mozilla.org"> +Must open automatically in new window (www.mozilla.org)</mylink> + <mylink xlink:type="simple" xlink:actuate="onLoad" xlink:show="new" xlink:href="http://www.mozillazine.org"> +Must open automatically in new window (www.mozillazine.org)</mylink> + <mylink xlink:type="simple" xlink:actuate="onLoad" xlink:show="replace" xlink:href="http://www.mozilla.org/mozorg.html"> +Must load automatically in same window - "Refresh" (At a glance)</mylink> + <mylink xlink:type="simple" xlink:actuate="onLoad" xlink:show="replace" xlink:href="http://www.netscape.com"> +Must not load automatically, one refresh link fired already (www.netscape.com)</mylink> +</root> + diff --git a/dom/xml/test/old/xlink/link.css b/dom/xml/test/old/xlink/link.css new file mode 100644 index 0000000000..19dc52198d --- /dev/null +++ b/dom/xml/test/old/xlink/link.css @@ -0,0 +1,22 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +@namespace xlink url(http://www.w3.org/1999/xlink); + +root { + display: block; + padding: +5px; +} + +p { + display: block; +} + +mylink { + display: block; + cursor: pointer; + color: blue; + text-decoration: underline; +} + diff --git a/dom/xml/test/old/xlink/manual.xml b/dom/xml/test/old/xlink/manual.xml new file mode 100644 index 0000000000..fd7d49fc17 --- /dev/null +++ b/dom/xml/test/old/xlink/manual.xml @@ -0,0 +1,14 @@ +<?xml version="1.0"?> +<?xml-stylesheet href="link.css" type="text/css"?> +<root xmlns:xlink="http://www.w3.org/1999/xlink"> + <p>Testing manual simple XLinks.</p> + <mylink xlink:type="simple" xlink:show="new" xlink:href="resource:/res/samples/test0.html"> +Must not open, illegal</mylink> + <mylink xlink:type="simple" xlink:show="new" xlink:href="http://www.mozilla.org"> +Must open in new window (www.mozilla.org)</mylink> + <mylink xlink:type="simple" xlink:show="replace" xlink:href="http://www.mozillazine.org"> +Must open in same window (www.mozillazine.org)</mylink> + <mylink xlink:type="simple" xlink:show="foo" xlink:href="http://www.mozilla.org/"> +Foo</mylink> +</root> + diff --git a/dom/xml/test/old/xmlbase/xmlbase.css b/dom/xml/test/old/xmlbase/xmlbase.css new file mode 100644 index 0000000000..a100186bbc --- /dev/null +++ b/dom/xml/test/old/xmlbase/xmlbase.css @@ -0,0 +1,28 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +@namespace xlink url(http://www.w3.org/1999/xlink); + +title { + font-weight: bold; + display: block; +} + +xlink|link { + color: blue; + text-decoration: underline; + cursor: pointer; + display: inline; + padding-left: +5px; +} + +sect1,sect2,sect3 { + display: block; + padding-left: +20px; +} + +p { + display: block; + padding-left: +5px; +}
\ No newline at end of file diff --git a/dom/xml/test/old/xmlbase/xmlbase.xml b/dom/xml/test/old/xmlbase/xmlbase.xml new file mode 100644 index 0000000000..b4cce1dc51 --- /dev/null +++ b/dom/xml/test/old/xmlbase/xmlbase.xml @@ -0,0 +1,82 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<?xml-stylesheet href="xmlbase.css" type="text/css"?> +<root xmlns:xlink="http://www.w3.org/1999/xlink"> +<title>Root: no xml:base</title> +<xlink:link xlink:type="simple" xlink:href="a.xml">a.xml</xlink:link> +<p>Expected: <current path>/a.xml</p> +<sect1 xml:base="http://www.mozilla.org"> + <title>Sect1: xml:base="http://www.mozilla.org"</title> + <xlink:link xlink:type="simple" xlink:href="b.xml">b.xml</xlink:link> + <p>Expected: http://www.mozilla.org/b.xml</p> + <sect2 xml:base="/base"> + <title>Sect2: xml:base="/base"</title> + <xlink:link xlink:type="simple" xlink:href="c.xml">c.xml</xlink:link> + <p>Expected: http://www.mozilla.org/base/c.xml</p> + <sect3 xml:base=""> + <title>Sect3: xml:base=""</title> + <xlink:link xlink:type="simple" xlink:href="d.xml">d.xml</xlink:link> + <p>Expected: http://www.mozilla.org/base/d.xml</p> + </sect3> + <sect3 xml:base="/"> + <title>Sect3: xml:base="/"</title> + <xlink:link xlink:type="simple" xlink:href="d-2.xml">d-2.xml</xlink:link> + <p>Expected: http://www.mozilla.org/d-2.xml</p> + </sect3> + <sect3 xml:base="/foobar"> + <title>Sect3: xml:base="/foobar"</title> + <xlink:link xlink:type="simple" xlink:href="e.xml">e.xml</xlink:link> + <p>Expected: http://www.mozilla.org/foobar/e.xml</p> + </sect3> + <sect3 xml:base="ding/dong"> + <title>Sect3: xml:base="ding/dong"</title> + <xlink:link xlink:type="simple" xlink:href="f.xml">f.xml</xlink:link> + <p>Expected: http://www.mozilla.org/base/ding/dong/f.xml</p> + </sect3> + </sect2> + <sect2 xml:base="http://www.netscape.com"> + <title>Sect2: xml:base="http://www.netscape.com"</title> + <xlink:link xlink:type="simple" xlink:href="g.xml">g.xml</xlink:link> + <p>Expected: http://www.netscape.com/g.xml</p> + </sect2> + <sect2 xml:base="http://www.netscape.com"> + <title>Sect2: xml:base="http://www.netscape.com"</title> + <xlink:link xlink:type="simple" xlink:href="http://www.mozilla.org/foobar/h.xml">http://www.mozilla.org/foobar/h.xml</xlink:link> + <p>Expected: http://www.mozilla.org/foobar/h.xml</p> + </sect2> + <sect2 xml:base="http://www.netscape.com"> + <title>Sect2: xml:base="http://www.netscape.com"</title> + <xlink:link xlink:type="simple" xlink:href="i.xml" xml:base="wow">i.xml, this element has xml:base="wow"</xlink:link> + <p>Expected: http://www.netscape.com/wow/i.xml</p> + </sect2> +</sect1> +<sect1 xml:base="nothere"> + <title>Sect1: xml:base="nothere"</title> + <xlink:link xlink:type="simple" xlink:href="j.xml">j.xml</xlink:link> + <p>Expected: <current path>/nothere/j.xml</p> +</sect1> +<sect1 xml:base="/not"> + <title>Sect1: xml:base="/not"</title> + <xlink:link xlink:type="simple" xlink:href="k.xml">k.xml</xlink:link> + <p>Expected: file:///not/k.xml</p> +</sect1> +<sect1 xml:base="http://foobar.com/ä ö/"> + <title>Sect1: xml:base="http://foobar.com/ä ö/"</title> + <xlink:link xlink:type="simple" xlink:href="l.xml">l.xml</xlink:link> + <p>Expected: http://foobar.com/%E4%20%F6/l.xml</p> +</sect1> +<sect1 xml:base="http://foobar.com/ /%20/"> + <title>Sect1: xml:base="http://foobar.com/ /%20/"</title> + <xlink:link xlink:type="simple" xlink:href="m.xml">m.xml</xlink:link> + <p>Expected: http://foobar.com/%20/%20/m.xml</p> +</sect1> +<sect1 xml:base="chrome://navigator"> + <title>Sect1: xml:base="chrome://navigator"</title> + <xlink:link xlink:type="simple" xlink:href="n.xml">n.xml</xlink:link> + <p>Expected: |current path|/n.xml because chrome URL is not allowed</p> + <sect2 xml:base="http://www.mozilla.org"> + <title>Sect2: xml:base="http://www.mozilla.org"</title> + <xlink:link xlink:type="simple" xlink:href="o.xml" xml:base="chrome://navigator">o.xml, this element has xml:base="chrome://navigator"</xlink:link> + <p>Expected: http://www.mozilla.org/o.xml because chrome base is not allowed</p> + </sect2> +</sect1> +</root>
\ No newline at end of file diff --git a/dom/xml/test/test_bug232004.xhtml b/dom/xml/test/test_bug232004.xhtml new file mode 100644 index 0000000000..a15129a71e --- /dev/null +++ b/dom/xml/test/test_bug232004.xhtml @@ -0,0 +1,38 @@ +<html xmlns="http://www.w3.org/1999/xhtml"> +<!-- +https://bugzilla.mozilla.org/show_bug.cgi?id=232004 +--> +<head> + <title>Test for Bug 232004</title> + <script src="/tests/SimpleTest/SimpleTest.js"></script> + <script src="/tests/SimpleTest/EventUtils.js"/> + <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> +</head> +<body> +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=232004">Mozilla Bug 232004</a> +<p id="display"> + <input id="one" type="text" /> + <input style="display: none" id="two" type="text" /> +</p> +<div id="content" style="display: none"> + +</div> +<pre id="test"> +<script class="testbody" type="text/javascript"> +<![CDATA[ + +/** Test for Bug 232004 **/ + +$("one").focus(); +is(document.activeElement, $("one"), "node one should be focused"); + +$("two").focus(); +isnot(document.activeElement, $("two"), + "node two has display:none and should not take focus"); + +]]> +</script> +</pre> +</body> +</html> + diff --git a/dom/xml/test/test_bug293347.html b/dom/xml/test/test_bug293347.html new file mode 100644 index 0000000000..6db99bdaa3 --- /dev/null +++ b/dom/xml/test/test_bug293347.html @@ -0,0 +1,33 @@ +<!DOCTYPE HTML> +<html> +<!-- +https://bugzilla.mozilla.org/show_bug.cgi?id=293347 +--> +<head> + <title>Test for Bug 293347</title> + <script src="/tests/SimpleTest/SimpleTest.js"></script> + <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> +</head> +<body> +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=293347">Mozilla Bug 293347</a> +<p id="display"></p> +<pre id="test"> +<script class="testbody" type="text/javascript"> + +SimpleTest.waitForExplicitFinish(); + +function done(iframe) { + let win = iframe.contentWindow; + is(win.document.getElementsByTagNameNS("http://www.w3.org/1999/xhtml", "div") + .length, 2, "doc still intact"); + is(win.document.body.namespaceURI, "http://www.w3.org/1999/xhtml", + "doc body still intact"); + is(win.didThrow, true, "doc.write throwing"); + SimpleTest.finish(); +} + +</script> +<iframe src="file_bug293347.xml" onload="done(this)"></iframe> +</pre> +</body> +</html> diff --git a/dom/xml/test/test_bug343870.xhtml b/dom/xml/test/test_bug343870.xhtml new file mode 100644 index 0000000000..7fa625211b --- /dev/null +++ b/dom/xml/test/test_bug343870.xhtml @@ -0,0 +1,39 @@ +<html xmlns="http://www.w3.org/1999/xhtml"> +<!-- +https://bugzilla.mozilla.org/show_bug.cgi?id=343870 +--> +<head> + <title>Test for Bug 343870</title> + <script src="/tests/SimpleTest/SimpleTest.js"></script> + <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> +</head> +<body> +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=343870">Mozilla Bug 343870</a> +<p id="display"></p> +<div id="content" style="display: none"> + +</div> +<pre id="test"> +<script class="testbody" type="text/javascript"> +<![CDATA[ + +/** Test for Bug 343870 **/ +function doTest() { + var dataDoc = document.getElementById("d").contentDocument; + is(dataDoc.getElementById("lf").firstChild.data, "\n"); + is(dataDoc.getElementById("cr").firstChild.data, "\n"); + is(dataDoc.getElementById("crlf").firstChild.data, "\n"); + is(dataDoc.getElementById("escapedcr").firstChild.data, "\r"); +} + +SimpleTest.waitForExplicitFinish(); +addLoadEvent(doTest); +addLoadEvent(SimpleTest.finish); + +]]> +</script> +</pre> +<iframe id="d" src="file_bug343870.xml"></iframe> +</body> +</html> + diff --git a/dom/xml/test/test_bug355213.xhtml b/dom/xml/test/test_bug355213.xhtml new file mode 100644 index 0000000000..3376a4b8b3 --- /dev/null +++ b/dom/xml/test/test_bug355213.xhtml @@ -0,0 +1,35 @@ +<html xmlns="http://www.w3.org/1999/xhtml"> +<!-- +https://bugzilla.mozilla.org/show_bug.cgi?id=355213 +--> +<head> + <title>Test for Bug 355213</title> + <script src="/tests/SimpleTest/SimpleTest.js"></script> + <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> +</head> +<body> +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=355213">Mozilla Bug 355213</a> +<p id="display"></p> +<div id="content" style="display: none"> + +</div> +<pre id="test"> +<script class="testbody" type="text/javascript"> +<![CDATA[ + +/** Test for Bug 355213 **/ + var firstWidth = document.getElementById('display').offsetWidth; + SimpleTest.waitForExplicitFinish(); + addLoadEvent( + function() { + is(firstWidth, document.getElementById('test').offsetWidth, + "Width should not change"); + }); + addLoadEvent(SimpleTest.finish); + +]]> +</script> +</pre> +</body> +</html> + diff --git a/dom/xml/test/test_bug691215.html b/dom/xml/test/test_bug691215.html new file mode 100644 index 0000000000..70a5f7b719 --- /dev/null +++ b/dom/xml/test/test_bug691215.html @@ -0,0 +1,53 @@ +<!DOCTYPE HTML> +<html> +<!-- +https://bugzilla.mozilla.org/show_bug.cgi?id=691215 +--> +<head> + <title>Test for Bug 691215</title> + <script src="/tests/SimpleTest/SimpleTest.js"></script> + <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> +</head> +<body> +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=691215">Mozilla Bug 691215</a> +<p id="display"></p> +<div id="content" style="display: none"> + +</div> +<pre id="test"> +<script type="application/javascript"> + +/** Test for Bug 691215 **/ + +SimpleTest.waitForExplicitFinish(); + +var BASE_URI = "http://mochi.test:8888/tests/dom/xml/test/"; +var url = BASE_URI + "file_bug691215.xml"; +var w; + +addLoadEvent(function() { + // Need a separate window because we do not prettyprint in iframes. This is + // why this test can't be a crashtest. + w = window.open(url); + // Need to poll for load completion, sadly + setTimeout(checker, 0); +}); + +function checker() { + if (w.location.href != url || + w.document.readyState != "complete") { + setTimeout(checker, 0); + return; + } + var doc = w.document; + var n = doc.createElement("span"); + doc.replaceChild(n, doc.documentElement); + w.close(); + ok(1, "Hey, we got here, that's good"); + SimpleTest.finish(); +} + +</script> +</pre> +</body> +</html> |