mirror of https://github.com/adamdruppe/arsd.git
minor bugs in new stuff
This commit is contained in:
parent
896c0fef33
commit
4964425cc3
17
dom.d
17
dom.d
|
@ -3680,7 +3680,9 @@ class Document : FileResource {
|
||||||
parseError("Attributes must be quoted");
|
parseError("Attributes must be quoted");
|
||||||
// read until whitespace or terminator (/ or >)
|
// read until whitespace or terminator (/ or >)
|
||||||
auto start = pos;
|
auto start = pos;
|
||||||
while(data[pos] != '>' &&
|
while(
|
||||||
|
pos < data.length &&
|
||||||
|
data[pos] != '>' &&
|
||||||
// unquoted attributes might be urls, so gotta be careful with them and self-closed elements
|
// unquoted attributes might be urls, so gotta be careful with them and self-closed elements
|
||||||
!(data[pos] == '/' && pos + 1 < data.length && data[pos+1] == '>') &&
|
!(data[pos] == '/' && pos + 1 < data.length && data[pos+1] == '>') &&
|
||||||
data[pos] != ' ' && data[pos] != '\n' && data[pos] != '\t')
|
data[pos] != ' ' && data[pos] != '\n' && data[pos] != '\t')
|
||||||
|
@ -3830,17 +3832,19 @@ class Document : FileResource {
|
||||||
auto start = pos;
|
auto start = pos;
|
||||||
while(pos < data.length && data[pos] != '>')
|
while(pos < data.length && data[pos] != '>')
|
||||||
pos++;
|
pos++;
|
||||||
|
|
||||||
|
auto bangEnds = pos;
|
||||||
if(pos == data.length) {
|
if(pos == data.length) {
|
||||||
if(strict)
|
if(strict)
|
||||||
throw new MarkupException("unclosed processing instruction (<!xxx>)");
|
throw new MarkupException("unclosed processing instruction (<!xxx>)");
|
||||||
} else pos++; // skipping the >
|
} else pos++; // skipping the >
|
||||||
|
|
||||||
if(parseSawBangInstruction !is null)
|
if(parseSawBangInstruction !is null)
|
||||||
if(parseSawBangInstruction(data[start .. pos])) {
|
if(parseSawBangInstruction(data[start .. bangEnds])) {
|
||||||
// FIXME: these should be able to modify the parser state,
|
// FIXME: these should be able to modify the parser state,
|
||||||
// doing things like adding entities, somehow.
|
// doing things like adding entities, somehow.
|
||||||
|
|
||||||
return Ele(3, new BangInstruction(this, data[start .. pos]), null);
|
return Ele(3, new BangInstruction(this, data[start .. bangEnds]), null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4040,7 +4044,9 @@ class Document : FileResource {
|
||||||
if(strict)
|
if(strict)
|
||||||
throw new Exception("tag " ~ tagName ~ " never closed");
|
throw new Exception("tag " ~ tagName ~ " never closed");
|
||||||
else {
|
else {
|
||||||
// let's call it totally empty
|
// let's call it totally empty and do the rest of the file as text. doing it as html could still result in some weird stuff like if(a<4) being read as <4 being a tag so it comes out if(a<4></4> and other weirdness) It is either a closed script tag or the rest of the file is forfeit.
|
||||||
|
e = new TextNode(this, data[pos .. $]);
|
||||||
|
pos = data.length;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ending += pos;
|
ending += pos;
|
||||||
|
@ -4168,6 +4174,9 @@ class Document : FileResource {
|
||||||
if(!strict && pos >= data.length)
|
if(!strict && pos >= data.length)
|
||||||
return addTag(false);
|
return addTag(false);
|
||||||
|
|
||||||
|
if(strict && pos >= data.length)
|
||||||
|
throw new MarkupException("tag open, didn't find > before end of file");
|
||||||
|
|
||||||
switch(data[pos]) {
|
switch(data[pos]) {
|
||||||
case '/': // self closing tag
|
case '/': // self closing tag
|
||||||
return addTag(true);
|
return addTag(true);
|
||||||
|
|
Loading…
Reference in New Issue