mirror of https://github.com/adamdruppe/arsd.git
script range check
This commit is contained in:
parent
326405df75
commit
c9e169ea98
25
dom.d
25
dom.d
|
|
@ -3720,14 +3720,25 @@ class Document : FileResource {
|
||||||
if(tagName == "script" || tagName == "style") {
|
if(tagName == "script" || tagName == "style") {
|
||||||
if(!selfClosed) {
|
if(!selfClosed) {
|
||||||
string closer = "</" ~ tagName ~ ">";
|
string closer = "</" ~ tagName ~ ">";
|
||||||
auto ending = indexOf(data[pos..$], closer);
|
typeof(indexOf(data, closer)) ending;
|
||||||
if(loose && ending == -1)
|
if(pos >= data.length)
|
||||||
|
ending = -1;
|
||||||
|
else
|
||||||
|
ending = indexOf(data[pos..$], closer);
|
||||||
|
|
||||||
|
if(loose && ending == -1 && pos < data.length)
|
||||||
ending = indexOf(data[pos..$], closer.toUpper);
|
ending = indexOf(data[pos..$], closer.toUpper);
|
||||||
if(ending == -1)
|
if(ending == -1) {
|
||||||
throw new Exception("tag " ~ tagName ~ " never closed");
|
if(strict)
|
||||||
ending += pos;
|
throw new Exception("tag " ~ tagName ~ " never closed");
|
||||||
e.innerRawSource = data[pos..ending];
|
else {
|
||||||
pos = ending + closer.length;
|
// let's call it totally empty
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
ending += pos;
|
||||||
|
e.innerRawSource = data[pos..ending];
|
||||||
|
pos = ending + closer.length;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return Ele(0, e, null);
|
return Ele(0, e, null);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue