https://project.mdnd-it.cc/work_packages/94
This commit is contained in:
2025-08-23 04:25:28 +02:00
parent 725516ad6c
commit 19cfa031d0
25823 changed files with 1095587 additions and 2801760 deletions
+2 -2
View File
@@ -1,6 +1,6 @@
The ISC License
Copyright (c) Isaac Z. Schlueter and Contributors
Copyright (c) 2010-2024 Isaac Z. Schlueter and Contributors
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
@@ -19,7 +19,7 @@ IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
`String.fromCodePoint` by Mathias Bynens used according to terms of MIT
License, as follows:
Copyright Mathias Bynens <https://mathiasbynens.be/>
Copyright (c) 2010-2024 Mathias Bynens <https://mathiasbynens.be/>
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
-188
View File
@@ -1,188 +0,0 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><meta name="generator" content="HTML Tidy for Mac OS X (vers 31 October 2006 - Apple Inc. build 13), see www.w3.org" /><title>W3C Software Notice and License</title><link rel="stylesheet" href="/2008/site/css/minimum" type="text/css" media="handheld, all" /><style type="text/css" media="print, screen and (min-width: 481px)" xml:space="preserve">
@import url("/2008/site/css/advanced");
</style><link href="/2008/site/css/minimum" rel="stylesheet" type="text/css" media="handheld, only screen and (max-device-width: 480px)" /><meta name="viewport" content="width=device-width" /><link rel="stylesheet" href="/2008/site/css/print" type="text/css" media="print" /><link rel="shortcut icon" href="/2008/site/images/favicon.ico" type="image/x-icon" /></head><body id="www-w3-org" class="w3c_public"><div id="w3c_container">
<div id="w3c_mast">
<h1 class="logo">
<a tabindex="2" accesskey="1" href="/"><img src="/2008/site/images/logo-w3c-mobile-lg" width="90" height="53" alt="W3C" /></a>
<span class="alt-logo">W3C</span>
</h1>
<div id="w3c_nav">
<form action="/Help/search" method="get" enctype="application/x-www-form-urlencoded"><div class="w3c_sec_nav"><!-- --></div><ul class="main_nav"><li class="first-item">
<a href="/standards/">Standards</a>
</li><li>
<a href="/participate/">Participate</a>
</li><li>
<a href="/Consortium/membership">Membership</a>
</li><li class="last-item">
<a href="/Consortium/">About W3C</a>
</li><li class="search-item">
<div id="search-form">
<input tabindex="3" class="text" name="q" value="" title="Search" type="text" />
<button id="search-submit" name="search-submit" type="submit"><img class="submit" src="/2008/site/images/search-button" alt="Search" width="21" height="17" /></button>
</div>
</li></ul></form>
</div>
</div>
<div id="w3c_main">
<div id="w3c_logo_shadow" class="w3c_leftCol">
<img height="32" alt="" src="/2008/site/images/logo-shadow" />
</div>
<div class="w3c_leftCol"><h2 class="offscreen">Site Navigation</h2>
<h3 class="category"><span class="ribbon"><a href="/Consortium/Legal/ipr-notice.html" title="Up to Policies and Legal Information">Policies and Legal Information <img src="/2008/site/images/header-link" alt="Header link" width="13" height="13" class="header-link" /></a></span></h3>
<ul class="theme">
<li><a href="/Consortium/Legal/2008/04-testsuite-copyright.html">Licenses for W3C Test Suites</a></li>
<li><a href="/2004/10/27-testcases.html">Policies for Contribution of Test Cases to W3C</a></li>
<li><a href="/Consortium/Legal/IPR-FAQ-20000620.html">Intellectual Rights FAQ</a></li>
<li><a href="/Consortium/Legal/privacy-statement-20000612.html">W3C Privacy Statements</a></li>
<li><a href="/Consortium/Legal/2002/copyright-documents-20021231.html">W3C Document License</a></li>
<li><a href="/Consortium/Legal/2002/trademarks-20021231.html">W3C Trademarks and Generic Terms</a></li>
<li><a href="/Consortium/Legal/2002/trademark-license-20021231.html">W3C&#xAE; Trademark and Service Mark License</a></li>
<li><a class="current">W3C Software Notice and License</a></li>
<li><a href="/Consortium/Legal/2002/collaborators-agreement-20021231.html">W3C Invited Expert and Collaborators Agreement</a></li>
<li><a href="/Consortium/Persistence.html">W3C URI Persistence Policy</a></li>
<li><a href="/1999/10/21-mirroring-policy.html">Mirroring the W3C Site</a></li>
<li><a href="/Consortium/Legal/2006/08-copyright-translations.html">Translations of the Copyright Notice</a></li>
</ul>
<br /></div>
<div class="w3c_mainCol">
<div id="w3c_crumbs">
<div id="w3c_crumbs_frame">
<ul class="bct"> <!-- .bct / Breadcrumbs -->
<li class="skip"><a tabindex="1" accesskey="2" title="Skip to content (e.g., when browsing via audio)" href="#w3c_content_body">Skip</a></li>
<li><a href="/">W3C</a>&#xA0;<span class="cr">&#xBB;</span>&#xA0;</li>
<li><a href="/Consortium/">About&#xA0;W3C</a>&#xA0;<span class="cr">&#xBB;</span>&#xA0;</li>
<li><a href="/Consortium/facts.html">Facts&#xA0;About&#xA0;W3C</a>&#xA0;<span class="cr">&#xBB;</span>&#xA0;</li>
<li><a href="/Consortium/Legal/ipr-notice.html">Policies&#xA0;and&#xA0;Legal&#xA0;Information</a>&#xA0;<span class="cr">&#xBB;</span>&#xA0;</li>
<li class="current">W3C Software Notice and License</li>
</ul>
</div>
</div>
<h1 class="title">W3C Software Notice and License</h1>
<div id="w3c_content_body">
<div class="line">
<p class="intro tPadding">This work (and included software, documentation such as READMEs, or other
related items) is being provided by the copyright holders under the following
license.</p>
<h2>License</h2>
<p class="tPadding">
By obtaining, using and/or copying this work, you (the licensee)
agree that you have read, understood, and will comply with the following
terms and conditions.</p>
<p>Permission to copy, modify, and distribute this software and its
documentation, with or without modification,&#xA0;for any purpose and without
fee or royalty is hereby granted, provided that you include the following on
ALL copies of the software and documentation or portions thereof, including
modifications:</p>
<ul class="show_items"><li>The full text of this NOTICE in a location viewable to users of the
redistributed or derivative work.</li><li>Any pre-existing intellectual property disclaimers, notices, or terms
and conditions. If none exist, the <a href="copyright-software-short-notice-20021231.html">W3C Software Short
Notice</a> should be included (hypertext is preferred, text is permitted)
within the body of any redistributed or derivative code.</li><li>Notice of any changes or modifications to the files, including the date
changes were made. (We recommend you provide URIs to the location from
which the code is derived.)</li></ul>
<h2>Disclaimers</h2>
<p>THIS SOFTWARE AND DOCUMENTATION IS PROVIDED "AS IS," AND COPYRIGHT HOLDERS
MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT
LIMITED TO, WARRANTIES OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR
PURPOSE OR THAT THE USE OF THE SOFTWARE OR DOCUMENTATION WILL NOT INFRINGE
ANY THIRD PARTY PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS.</p>
<p>COPYRIGHT HOLDERS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL OR
CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THE SOFTWARE OR
DOCUMENTATION.</p>
<p>The name and trademarks of copyright holders may NOT be used in
advertising or publicity pertaining to the software without specific, written
prior permission. Title to copyright in this software and any associated
documentation will at all times remain with copyright holders.</p>
<h2>Notes</h2>
<p>This version: http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231</p>
<p>This formulation of W3C's notice and license became active on December 31
2002. This version removes the copyright ownership notice such that this
license can be used with materials other than those owned by the W3C,
reflects that ERCIM is now a host of the W3C, includes references to this
specific dated version of the license, and removes the ambiguous grant of
"use". Otherwise, this version is the same as the <a href="http://www.w3.org/Consortium/Legal/copyright-software-19980720">previous
version</a> and is written so as to preserve the <a href="http://www.gnu.org/philosophy/license-list.html#GPLCompatibleLicenses">Free
Software Foundation's assessment of GPL compatibility</a> and <a href="http://www.opensource.org/licenses/W3C.php">OSI's certification</a>
under the <a href="http://www.opensource.org/docs/definition.php">Open Source
Definition</a>.</p>
</div>
</div>
</div>
</div>
</div><div id="w3c_footer">
<div id="w3c_footer-inner">
<h2 class="offscreen">Footer Navigation</h2>
<div class="w3c_footer-nav">
<h3>Navigation</h3>
<ul class="footer_top_nav"><li>
<a href="/">Home</a>
</li><li>
<a href="/standards/">Standards</a>
</li><li>
<a href="/participate/">Participate</a>
</li><li>
<a href="/Consortium/membership">Membership</a>
</li><li class="last-item">
<a href="/Consortium/">About W3C</a>
</li></ul>
</div>
<div class="w3c_footer-nav">
<h3>Contact W3C</h3>
<ul class="footer_bottom_nav"><li>
<a href="/Consortium/contact">Contact</a>
</li><li>
<a accesskey="0" href="/Help/">Help and FAQ</a>
</li><li>
<a href="/Consortium/sponsor/">Sponsor / Donate</a>
</li><li>
<a href="/Consortium/siteindex">Site Map</a>
</li><li>
<address id="w3c_signature">
<a href="http://lists.w3.org/Archives/Public/site-comments/">Feedback</a></address>
</li></ul>
</div>
<div class="w3c_footer-nav">
<h3>W3C Updates</h3>
<ul class="footer_follow_nav"><li>
<a href="http://twitter.com/W3C" title="Follow W3C on Twitter">
<img src="/2008/site/images/twitter-bird" alt="Twitter" width="78" height="83" class="social-icon" />
</a>
<a href="http://identi.ca/w3c" title="See W3C on Identica">
<img src="/2008/site/images/identica-logo" alt="Identica" width="91" height="83" class="social-icon" />
</a>
</li></ul>
</div>
<p class="copyright">Copyright &#xA9; 2012 W3C <sup>&#xAE;</sup> (<a href="http://www.csail.mit.edu/">
<acronym title="Massachusetts Institute of Technology">MIT</acronym>
</a>, <a href="http://www.ercim.org/">
<acronym title="European Research Consortium for Informatics and Mathematics"> ERCIM</acronym>
</a>, <a href="http://www.keio.ac.jp/">Keio</a>) <a href="/Consortium/Legal/ipr-notice">Usage policies apply</a>.</p>
</div>
</div><!-- Generated from data/scripts.php, ../../smarty/{scripts.tpl} --><!-- At the bottom for performance reasons --><div id="w3c_scripts">
<script type="text/javascript" src="/2008/site/js/main" xml:space="preserve"><!-- --></script>
</div></body></html>
+3
View File
@@ -106,6 +106,9 @@ Settings supported:
* `strictEntities` - Boolean. If true, only parse [predefined XML
entities](http://www.w3.org/TR/REC-xml/#sec-predefined-ent)
(`&amp;`, `&apos;`, `&gt;`, `&lt;`, and `&quot;`)
* `unquotedAttributeValues` - Boolean. If true, then unquoted
attribute values are allowed. Defaults to `false` when `strict`
is true, `true` otherwise.
## Methods
+91 -70
View File
@@ -71,6 +71,12 @@
parser.ns = Object.create(rootNS)
}
// disallow unquoted attribute values if not otherwise configured
// and strict mode is true
if (parser.opt.unquotedAttributeValues === undefined) {
parser.opt.unquotedAttributeValues = !strict;
}
// mostly just for error reporting
parser.trackPosition = parser.opt.position !== false
if (parser.trackPosition) {
@@ -164,6 +170,7 @@
} catch (ex) {
Stream = function () {}
}
if (!Stream) Stream = function () {}
var streamWraps = sax.EVENTS.filter(function (ev) {
return ev !== 'error' && ev !== 'end'
@@ -262,28 +269,14 @@
return Stream.prototype.on.call(me, ev, handler)
}
// character classes and tokens
var whitespace = '\r\n\t '
// this really needs to be replaced with character classes.
// XML allows all manner of ridiculous numbers and digits.
var number = '0124356789'
var letter = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
// (Letter | "_" | ":")
var quote = '\'"'
var attribEnd = whitespace + '>'
var CDATA = '[CDATA['
var DOCTYPE = 'DOCTYPE'
var XML_NAMESPACE = 'http://www.w3.org/XML/1998/namespace'
var XMLNS_NAMESPACE = 'http://www.w3.org/2000/xmlns/'
var rootNS = { xml: XML_NAMESPACE, xmlns: XMLNS_NAMESPACE }
// turn all the string character sets into character class objects.
whitespace = charClass(whitespace)
number = charClass(number)
letter = charClass(letter)
// http://www.w3.org/TR/REC-xml/#NT-NameStartChar
// This implementation works on strings, a single character at a time
// as such, it cannot ever support astral-plane characters (10000-EFFFF)
@@ -292,31 +285,29 @@
// is left as an exercise for the reader.
var nameStart = /[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/
var nameBody = /[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040\.\d-]/
var nameBody = /[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040.\d-]/
var entityStart = /[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/
var entityBody = /[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040\.\d-]/
var entityBody = /[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040.\d-]/
quote = charClass(quote)
attribEnd = charClass(attribEnd)
function charClass (str) {
return str.split('').reduce(function (s, c) {
s[c] = true
return s
}, {})
function isWhitespace (c) {
return c === ' ' || c === '\n' || c === '\r' || c === '\t'
}
function isRegExp (c) {
return Object.prototype.toString.call(c) === '[object RegExp]'
function isQuote (c) {
return c === '"' || c === '\''
}
function is (charclass, c) {
return isRegExp(charclass) ? !!c.match(charclass) : charclass[c]
function isAttribEnd (c) {
return c === '>' || isWhitespace(c)
}
function not (charclass, c) {
return !is(charclass, c)
function isMatch (regex, c) {
return regex.test(c)
}
function notMatch (regex, c) {
return !isMatch(regex, c)
}
var S = 0
@@ -949,7 +940,7 @@
}
}
entity = entity.replace(/^0+/, '')
if (numStr.toLowerCase() !== entity) {
if (isNaN(num) || numStr.toLowerCase() !== entity) {
strictFail(parser, 'Invalid character entity')
return '&' + parser.entity + ';'
}
@@ -961,7 +952,7 @@
if (c === '<') {
parser.state = S.OPEN_WAKA
parser.startTagPosition = parser.position
} else if (not(whitespace, c)) {
} else if (!isWhitespace(c)) {
// have to process this as a text node.
// weird, but happens.
strictFail(parser, 'Non-whitespace before first tag.')
@@ -998,9 +989,11 @@
while (true) {
c = charAt(chunk, i++)
parser.c = c
if (!c) {
break
}
if (parser.trackPosition) {
parser.position++
if (c === '\n') {
@@ -1010,6 +1003,7 @@
parser.column++
}
}
switch (parser.state) {
case S.BEGIN:
parser.state = S.BEGIN_WHITESPACE
@@ -1044,7 +1038,7 @@
parser.state = S.OPEN_WAKA
parser.startTagPosition = parser.position
} else {
if (not(whitespace, c) && (!parser.sawRoot || parser.closedRoot)) {
if (!isWhitespace(c) && (!parser.sawRoot || parser.closedRoot)) {
strictFail(parser, 'Text data outside of root node.')
}
if (c === '&') {
@@ -1078,9 +1072,9 @@
if (c === '!') {
parser.state = S.SGML_DECL
parser.sgmlDecl = ''
} else if (is(whitespace, c)) {
} else if (isWhitespace(c)) {
// wait for it...
} else if (is(nameStart, c)) {
} else if (isMatch(nameStart, c)) {
parser.state = S.OPEN_TAG
parser.tagName = c
} else if (c === '/') {
@@ -1102,15 +1096,22 @@
continue
case S.SGML_DECL:
if ((parser.sgmlDecl + c).toUpperCase() === CDATA) {
if (parser.sgmlDecl + c === '--') {
parser.state = S.COMMENT
parser.comment = ''
parser.sgmlDecl = ''
continue;
}
if (parser.doctype && parser.doctype !== true && parser.sgmlDecl) {
parser.state = S.DOCTYPE_DTD
parser.doctype += '<!' + parser.sgmlDecl + c
parser.sgmlDecl = ''
} else if ((parser.sgmlDecl + c).toUpperCase() === CDATA) {
emitNode(parser, 'onopencdata')
parser.state = S.CDATA
parser.sgmlDecl = ''
parser.cdata = ''
} else if (parser.sgmlDecl + c === '--') {
parser.state = S.COMMENT
parser.comment = ''
parser.sgmlDecl = ''
} else if ((parser.sgmlDecl + c).toUpperCase() === DOCTYPE) {
parser.state = S.DOCTYPE
if (parser.doctype || parser.sawRoot) {
@@ -1123,7 +1124,7 @@
emitNode(parser, 'onsgmldeclaration', parser.sgmlDecl)
parser.sgmlDecl = ''
parser.state = S.TEXT
} else if (is(quote, c)) {
} else if (isQuote(c)) {
parser.state = S.SGML_DECL_QUOTED
parser.sgmlDecl += c
} else {
@@ -1148,7 +1149,7 @@
parser.doctype += c
if (c === '[') {
parser.state = S.DOCTYPE_DTD
} else if (is(quote, c)) {
} else if (isQuote(c)) {
parser.state = S.DOCTYPE_QUOTED
parser.q = c
}
@@ -1164,12 +1165,18 @@
continue
case S.DOCTYPE_DTD:
parser.doctype += c
if (c === ']') {
parser.doctype += c
parser.state = S.DOCTYPE
} else if (is(quote, c)) {
} else if (c === '<') {
parser.state = S.OPEN_WAKA
parser.startTagPosition = parser.position
} else if (isQuote(c)) {
parser.doctype += c
parser.state = S.DOCTYPE_DTD_QUOTED
parser.q = c
} else {
parser.doctype += c
}
continue
@@ -1210,6 +1217,8 @@
// which is a comment of " blah -- bloo "
parser.comment += '--' + c
parser.state = S.COMMENT
} else if (parser.doctype && parser.doctype !== true) {
parser.state = S.DOCTYPE_DTD
} else {
parser.state = S.TEXT
}
@@ -1251,7 +1260,7 @@
case S.PROC_INST:
if (c === '?') {
parser.state = S.PROC_INST_ENDING
} else if (is(whitespace, c)) {
} else if (isWhitespace(c)) {
parser.state = S.PROC_INST_BODY
} else {
parser.procInstName += c
@@ -1259,7 +1268,7 @@
continue
case S.PROC_INST_BODY:
if (!parser.procInstBody && is(whitespace, c)) {
if (!parser.procInstBody && isWhitespace(c)) {
continue
} else if (c === '?') {
parser.state = S.PROC_INST_ENDING
@@ -1283,7 +1292,7 @@
continue
case S.OPEN_TAG:
if (is(nameBody, c)) {
if (isMatch(nameBody, c)) {
parser.tagName += c
} else {
newTag(parser)
@@ -1292,7 +1301,7 @@
} else if (c === '/') {
parser.state = S.OPEN_TAG_SLASH
} else {
if (not(whitespace, c)) {
if (!isWhitespace(c)) {
strictFail(parser, 'Invalid character in tag name')
}
parser.state = S.ATTRIB
@@ -1312,13 +1321,13 @@
case S.ATTRIB:
// haven't read the attribute name yet.
if (is(whitespace, c)) {
if (isWhitespace(c)) {
continue
} else if (c === '>') {
openTag(parser)
} else if (c === '/') {
parser.state = S.OPEN_TAG_SLASH
} else if (is(nameStart, c)) {
} else if (isMatch(nameStart, c)) {
parser.attribName = c
parser.attribValue = ''
parser.state = S.ATTRIB_NAME
@@ -1335,9 +1344,9 @@
parser.attribValue = parser.attribName
attrib(parser)
openTag(parser)
} else if (is(whitespace, c)) {
} else if (isWhitespace(c)) {
parser.state = S.ATTRIB_NAME_SAW_WHITE
} else if (is(nameBody, c)) {
} else if (isMatch(nameBody, c)) {
parser.attribName += c
} else {
strictFail(parser, 'Invalid attribute name')
@@ -1347,7 +1356,7 @@
case S.ATTRIB_NAME_SAW_WHITE:
if (c === '=') {
parser.state = S.ATTRIB_VALUE
} else if (is(whitespace, c)) {
} else if (isWhitespace(c)) {
continue
} else {
strictFail(parser, 'Attribute without value')
@@ -1360,7 +1369,7 @@
parser.attribName = ''
if (c === '>') {
openTag(parser)
} else if (is(nameStart, c)) {
} else if (isMatch(nameStart, c)) {
parser.attribName = c
parser.state = S.ATTRIB_NAME
} else {
@@ -1371,13 +1380,15 @@
continue
case S.ATTRIB_VALUE:
if (is(whitespace, c)) {
if (isWhitespace(c)) {
continue
} else if (is(quote, c)) {
} else if (isQuote(c)) {
parser.q = c
parser.state = S.ATTRIB_VALUE_QUOTED
} else {
strictFail(parser, 'Unquoted attribute value')
if (!parser.opt.unquotedAttributeValues) {
error(parser, 'Unquoted attribute value')
}
parser.state = S.ATTRIB_VALUE_UNQUOTED
parser.attribValue = c
}
@@ -1398,13 +1409,13 @@
continue
case S.ATTRIB_VALUE_CLOSED:
if (is(whitespace, c)) {
if (isWhitespace(c)) {
parser.state = S.ATTRIB
} else if (c === '>') {
openTag(parser)
} else if (c === '/') {
parser.state = S.OPEN_TAG_SLASH
} else if (is(nameStart, c)) {
} else if (isMatch(nameStart, c)) {
strictFail(parser, 'No whitespace between attributes')
parser.attribName = c
parser.attribValue = ''
@@ -1415,7 +1426,7 @@
continue
case S.ATTRIB_VALUE_UNQUOTED:
if (not(attribEnd, c)) {
if (!isAttribEnd(c)) {
if (c === '&') {
parser.state = S.ATTRIB_VALUE_ENTITY_U
} else {
@@ -1433,9 +1444,9 @@
case S.CLOSE_TAG:
if (!parser.tagName) {
if (is(whitespace, c)) {
if (isWhitespace(c)) {
continue
} else if (not(nameStart, c)) {
} else if (notMatch(nameStart, c)) {
if (parser.script) {
parser.script += '</' + c
parser.state = S.SCRIPT
@@ -1447,14 +1458,14 @@
}
} else if (c === '>') {
closeTag(parser)
} else if (is(nameBody, c)) {
} else if (isMatch(nameBody, c)) {
parser.tagName += c
} else if (parser.script) {
parser.script += '</' + parser.tagName
parser.tagName = ''
parser.state = S.SCRIPT
} else {
if (not(whitespace, c)) {
if (!isWhitespace(c)) {
strictFail(parser, 'Invalid tagname in closing tag')
}
parser.state = S.CLOSE_TAG_SAW_WHITE
@@ -1462,7 +1473,7 @@
continue
case S.CLOSE_TAG_SAW_WHITE:
if (is(whitespace, c)) {
if (isWhitespace(c)) {
continue
}
if (c === '>') {
@@ -1495,10 +1506,17 @@
}
if (c === ';') {
parser[buffer] += parseEntity(parser)
parser.entity = ''
parser.state = returnState
} else if (is(parser.entity.length ? entityBody : entityStart, c)) {
var parsedEntity = parseEntity(parser)
if (parser.opt.unparsedEntities && !Object.values(sax.XML_ENTITIES).includes(parsedEntity)) {
parser.entity = ''
parser.state = returnState
parser.write(parsedEntity)
} else {
parser[buffer] += parsedEntity
parser.entity = ''
parser.state = returnState
}
} else if (isMatch(parser.entity.length ? entityBody : entityStart, c)) {
parser.entity += c
} else {
strictFail(parser, 'Invalid character in entity name')
@@ -1509,8 +1527,9 @@
continue
default:
default: /* istanbul ignore next */ {
throw new Error(parser, 'Unknown state: ' + parser.state)
}
}
} // while
@@ -1521,6 +1540,7 @@
}
/*! http://mths.be/fromcodepoint v0.1.0 by @mathias */
/* istanbul ignore next */
if (!String.fromCodePoint) {
(function () {
var stringFromCharCode = String.fromCharCode
@@ -1562,6 +1582,7 @@
}
return result
}
/* istanbul ignore next */
if (Object.defineProperty) {
Object.defineProperty(String, 'fromCodePoint', {
value: fromCodePoint,
+12 -6
View File
@@ -2,22 +2,28 @@
"name": "sax",
"description": "An evented streaming XML parser in JavaScript",
"author": "Isaac Z. Schlueter <i@izs.me> (http://blog.izs.me/)",
"version": "1.2.1",
"version": "1.4.1",
"main": "lib/sax.js",
"license": "ISC",
"scripts": {
"test": "tap test/*.js --cov",
"posttest": "standard -F test/*.js lib/*.js"
"test": "tap test/*.js --cov -j4",
"preversion": "npm test",
"postversion": "npm publish",
"postpublish": "git push origin --all; git push origin --tags"
},
"repository": "git://github.com/isaacs/sax-js.git",
"files": [
"lib/sax.js",
"LICENSE",
"LICENSE-W3C.html",
"README.md"
],
"devDependencies": {
"standard": "^5.3.1",
"tap": "^5.2.0"
"tap": "^15.1.6"
},
"tap": {
"statements": 79,
"branches": 75,
"functions": 80,
"lines": 79
}
}