mirror of https://github.com/adamdruppe/arsd.git
more garbage handling
This commit is contained in:
parent
3077ffe763
commit
8159da80c5
14
dom.d
14
dom.d
|
@ -3446,6 +3446,11 @@ class Document : FileResource {
|
||||||
else
|
else
|
||||||
break; // e.g. <a href="something" <img src="poo" /></a>. The > should have been after the href, but some shitty files don't do that right and the browser handles it, so we will too, by pretending the > was indeed there
|
break; // e.g. <a href="something" <img src="poo" /></a>. The > should have been after the href, but some shitty files don't do that right and the browser handles it, so we will too, by pretending the > was indeed there
|
||||||
pos++;
|
pos++;
|
||||||
|
if(pos == data.length)
|
||||||
|
if(strict)
|
||||||
|
throw new Exception("unterminated attribute name");
|
||||||
|
else
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!caseSensitive)
|
if(!caseSensitive)
|
||||||
|
@ -3801,11 +3806,20 @@ class Document : FileResource {
|
||||||
default: // it is an attribute
|
default: // it is an attribute
|
||||||
string attrName = readAttributeName();
|
string attrName = readAttributeName();
|
||||||
string attrValue = attrName;
|
string attrValue = attrName;
|
||||||
|
if(pos >= data.length)
|
||||||
|
if(strict)
|
||||||
|
assert(0, "this should have thrown in readAttributeName");
|
||||||
|
else {
|
||||||
|
data ~= ">";
|
||||||
|
goto blankValue;
|
||||||
|
}
|
||||||
if(data[pos] == '=') {
|
if(data[pos] == '=') {
|
||||||
pos++;
|
pos++;
|
||||||
attrValue = readAttributeValue();
|
attrValue = readAttributeValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
blankValue:
|
||||||
|
|
||||||
if(strict && attrName in attributes)
|
if(strict && attrName in attributes)
|
||||||
throw new MarkupException("Repeated attribute: " ~ attrName);
|
throw new MarkupException("Repeated attribute: " ~ attrName);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue