This commit is contained in:
Gary Willoughby 2013-06-04 04:08:13 -07:00
commit 4c64b830fd
1 changed files with 73 additions and 73 deletions

146
dom.d
View File

@ -115,7 +115,7 @@ mixin template DomConvenienceFunctions() {
n ~= name; n ~= name;
} }
className = n.strip; className = n.strip();
return this; return this;
} }
@ -259,7 +259,7 @@ mixin template DomConvenienceFunctions() {
body { body {
auto e = Element.make(tagName, "", info2); auto e = Element.make(tagName, "", info2);
this.appendChild(e); this.appendChild(e);
e.innerHTML = innerHtml.source; e.innerHTML(innerHtml.source);
return e; return e;
} }
@ -585,8 +585,8 @@ struct ElementStyle {
if(idx == -1) if(idx == -1)
ret[rule] = ""; ret[rule] = "";
else { else {
auto name = rule[0 .. idx].strip; auto name = rule[0 .. idx].strip();
auto value = rule[idx + 1 .. $].strip; auto value = rule[idx + 1 .. $].strip();
ret[name] = value; ret[name] = value;
} }
@ -822,7 +822,7 @@ class Element {
e.rel = childInfo2; e.rel = childInfo2;
break; break;
case "option": case "option":
e.innerText = childInfo; e.innerText(childInfo);
if(childInfo2 !is null) if(childInfo2 !is null)
e.value = childInfo2; e.value = childInfo2;
break; break;
@ -833,12 +833,12 @@ class Element {
e.value = childInfo2; e.value = childInfo2;
break; break;
case "button": case "button":
e.innerText = childInfo; e.innerText(childInfo);
if(childInfo2 !is null) if(childInfo2 !is null)
e.type = childInfo2; e.type = childInfo2;
break; break;
case "a": case "a":
e.innerText = childInfo; e.innerText(childInfo);
if(childInfo2 !is null) if(childInfo2 !is null)
e.href = childInfo2; e.href = childInfo2;
break; break;
@ -853,7 +853,7 @@ class Element {
break; break;
/* generically, assume we were passed text and perhaps class */ /* generically, assume we were passed text and perhaps class */
default: default:
e.innerText = childInfo; e.innerText(childInfo);
if(childInfo2.length) if(childInfo2.length)
e.className = childInfo2; e.className = childInfo2;
} }
@ -864,7 +864,7 @@ class Element {
static Element make(string tagName, in Html innerHtml, string childInfo2 = null) { static Element make(string tagName, in Html innerHtml, string childInfo2 = null) {
// FIXME: childInfo2 is ignored when info1 is null // FIXME: childInfo2 is ignored when info1 is null
auto m = Element.make(tagName, cast(string) null, childInfo2); auto m = Element.make(tagName, cast(string) null, childInfo2);
m.innerHTML = innerHtml.source; m.innerHTML(innerHtml.source);
return m; return m;
} }
@ -1130,9 +1130,9 @@ class Element {
name = name.toLower(); name = name.toLower();
// I never use this shit legitimately and neither should you // I never use this shit legitimately and neither should you
auto it = name.toLower; auto it = name.toLower();
if(it == "href" || it == "src") { if(it == "href" || it == "src") {
auto v = value.strip.toLower(); auto v = value.strip().toLower();
if(v.startsWith("vbscript:")) if(v.startsWith("vbscript:"))
value = value[9..$]; value = value[9..$];
if(v.startsWith("javascript:")) if(v.startsWith("javascript:"))
@ -1796,7 +1796,7 @@ class Element {
string s; string s;
foreach(child; children) { foreach(child; children) {
if(child.nodeType != NodeType.Text) if(child.nodeType != NodeType.Text)
s ~= child.innerText; s ~= child.innerText();
else else
s ~= child.nodeValue(); s ~= child.nodeValue();
} }
@ -1954,7 +1954,7 @@ class Element {
// Ideally, I'd put them in arsd.html and use UFCS, but that doesn't work with the opDispatch here. // Ideally, I'd put them in arsd.html and use UFCS, but that doesn't work with the opDispatch here.
/// Tags: HTML, HTML5 /// Tags: HTML, HTML5
// FIXME: add overloads for other label types... // FIXME: add overloads for other label types...
Element addField(string label, string name, string type = "text", FormFieldOptions fieldOptions = FormFieldOptions.none) { Element addField(string label, string name, string type = "text", FormFieldOptions fieldOptions = FormFieldOptions.none()) {
auto fs = this; auto fs = this;
auto i = fs.addChild("label"); auto i = fs.addChild("label");
i.addChild("span", label); i.addChild("span", label);
@ -1973,7 +1973,7 @@ class Element {
return i; return i;
} }
Element addField(Element label, string name, string type = "text", FormFieldOptions fieldOptions = FormFieldOptions.none) { Element addField(Element label, string name, string type = "text", FormFieldOptions fieldOptions = FormFieldOptions.none()) {
auto fs = this; auto fs = this;
auto i = fs.addChild("label"); auto i = fs.addChild("label");
i.addChild(label); i.addChild(label);
@ -1996,7 +1996,7 @@ class Element {
return addField(label, name, "text", fieldOptions); return addField(label, name, "text", fieldOptions);
} }
Element addField(string label, string name, string[string] options, FormFieldOptions fieldOptions = FormFieldOptions.none) { Element addField(string label, string name, string[string] options, FormFieldOptions fieldOptions = FormFieldOptions.none()) {
auto fs = this; auto fs = this;
auto i = fs.addChild("label"); auto i = fs.addChild("label");
i.addChild("span", label); i.addChild("span", label);
@ -2628,7 +2628,7 @@ class Link : Element {
this(string href, string text) { this(string href, string text) {
super("a"); super("a");
setAttribute("href", href); setAttribute("href", href);
innerText = text; innerText(text);
} }
/+ /+
/// Returns everything in the href EXCEPT the query string /// Returns everything in the href EXCEPT the query string
@ -2761,7 +2761,7 @@ class Form : Element {
tagName = "form"; tagName = "form";
} }
override Element addField(string label, string name, string type = "text", FormFieldOptions fieldOptions = FormFieldOptions.none) { override Element addField(string label, string name, string type = "text", FormFieldOptions fieldOptions = FormFieldOptions.none()) {
auto t = this.querySelector("fieldset div"); auto t = this.querySelector("fieldset div");
if(t is null) if(t is null)
return super.addField(label, name, type, fieldOptions); return super.addField(label, name, type, fieldOptions);
@ -2778,7 +2778,7 @@ class Form : Element {
return t.addField(label, name, type, fieldOptions); return t.addField(label, name, type, fieldOptions);
} }
override Element addField(string label, string name, string[string] options, FormFieldOptions fieldOptions = FormFieldOptions.none) { override Element addField(string label, string name, string[string] options, FormFieldOptions fieldOptions = FormFieldOptions.none()) {
auto t = this.querySelector("fieldset div"); auto t = this.querySelector("fieldset div");
if(t is null) if(t is null)
return super.addField(label, name, options, fieldOptions); return super.addField(label, name, options, fieldOptions);
@ -2810,7 +2810,7 @@ class Form : Element {
switch(e.tagName) { switch(e.tagName) {
default: assert(0); default: assert(0);
case "textarea": case "textarea":
e.innerText = value; e.innerText(value);
break; break;
case "input": case "input":
string type = e.getAttribute("type"); string type = e.getAttribute("type");
@ -2838,7 +2838,7 @@ class Form : Element {
continue; continue;
string val = child.getAttribute("value"); string val = child.getAttribute("value");
if(val is null) if(val is null)
val = child.innerText; val = child.innerText();
if(val == value) { if(val == value) {
child.setAttribute("selected", "selected"); child.setAttribute("selected", "selected");
found = true; found = true;
@ -2892,7 +2892,7 @@ class Form : Element {
} else } else
return e.value; return e.value;
case "textarea": case "textarea":
return e.innerText; return e.innerText();
case "select": case "select":
foreach(child; e.tree) { foreach(child; e.tree) {
if(child.tagName != "option") if(child.tagName != "option")
@ -3124,12 +3124,12 @@ class Table : Element {
///. ///.
@property string caption() { @property string caption() {
return captionElement().innerText; return captionElement().innerText();
} }
///. ///.
@property void caption(string text) { @property void caption(string text) {
captionElement().innerText = text; captionElement().innerText(text);
} }
/// Gets the logical layout of the table as a rectangular grid of /// Gets the logical layout of the table as a rectangular grid of
@ -3600,7 +3600,7 @@ class Document : FileResource {
} }
void eatWhitespace() { void eatWhitespace() {
while(pos < data.length && (data[pos] == ' ' || data[pos] == '\n' || data[pos] == '\t')) while(pos < data.length() && (data[pos] == ' ' || data[pos] == '\n' || data[pos] == '\t'))
pos++; pos++;
} }
@ -3612,7 +3612,7 @@ class Document : FileResource {
data[pos] != ' ' && data[pos] != '\n' && data[pos] != '\t') data[pos] != ' ' && data[pos] != '\n' && data[pos] != '\t')
{ {
pos++; pos++;
if(pos == data.length) { if(pos == data.length()) {
if(strict) if(strict)
throw new Exception("tag name incomplete when file ended"); throw new Exception("tag name incomplete when file ended");
else else
@ -3640,7 +3640,7 @@ class Document : FileResource {
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(pos == data.length()) {
if(strict) if(strict)
throw new Exception("unterminated attribute name"); throw new Exception("unterminated attribute name");
else else
@ -3655,7 +3655,7 @@ class Document : FileResource {
} }
string readAttributeValue() { string readAttributeValue() {
if(pos >= data.length) { if(pos >= data.length()) {
if(strict) if(strict)
throw new Exception("no attribute value before end of file"); throw new Exception("no attribute value before end of file");
else else
@ -3668,9 +3668,9 @@ class Document : FileResource {
char end = data[pos]; char end = data[pos];
pos++; pos++;
auto start = pos; auto start = pos;
while(pos < data.length && data[pos] != end) while(pos < data.length() && data[pos] != end)
pos++; pos++;
if(strict && pos == data.length) if(strict && pos == data.length())
throw new MarkupException("Unclosed attribute value, started on char " ~ to!string(started)); throw new MarkupException("Unclosed attribute value, started on char " ~ to!string(started));
string v = htmlEntitiesDecode(data[start..pos], strict); string v = htmlEntitiesDecode(data[start..pos], strict);
pos++; // skip over the end pos++; // skip over the end
@ -3682,7 +3682,7 @@ class Document : FileResource {
auto start = pos; auto start = pos;
while(data[pos] != '>' && while(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')
pos++; pos++;
@ -3694,7 +3694,7 @@ class Document : FileResource {
TextNode readTextNode() { TextNode readTextNode() {
auto start = pos; auto start = pos;
while(pos < data.length && data[pos] != '<') { while(pos < data.length() && data[pos] != '<') {
pos++; pos++;
} }
@ -3704,7 +3704,7 @@ class Document : FileResource {
// this is obsolete! // this is obsolete!
RawSource readCDataNode() { RawSource readCDataNode() {
auto start = pos; auto start = pos;
while(pos < data.length && data[pos] != '<') { while(pos < data.length() && data[pos] != '<') {
pos++; pos++;
} }
@ -3733,7 +3733,7 @@ class Document : FileResource {
static string[] recentAutoClosedTags; static string[] recentAutoClosedTags;
if(pos >= data.length) if(pos >= data.length())
{ {
if(strict) { if(strict) {
throw new MarkupException("Gone over the input (is there no root element or did it never close?), chain: " ~ to!string(parentChain)); throw new MarkupException("Gone over the input (is there no root element or did it never close?), chain: " ~ to!string(parentChain));
@ -3751,7 +3751,7 @@ class Document : FileResource {
enforce(data[pos] == '<'); enforce(data[pos] == '<');
pos++; pos++;
if(pos == data.length) { if(pos == data.length()) {
if(strict) if(strict)
throw new MarkupException("Found trailing < at end of file"); throw new MarkupException("Found trailing < at end of file");
// if not strict, we'll just skip the switch // if not strict, we'll just skip the switch
@ -3764,10 +3764,10 @@ class Document : FileResource {
// FIXME: we should store these in the tree too // FIXME: we should store these in the tree too
// though I like having it stripped out tbh. // though I like having it stripped out tbh.
if(pos == data.length) { if(pos == data.length()) {
if(strict) if(strict)
throw new MarkupException("<! opened at end of file"); throw new MarkupException("<! opened at end of file");
} else if(data[pos] == '-' && (pos + 1 < data.length) && data[pos+1] == '-') { } else if(data[pos] == '-' && (pos + 1 < data.length()) && data[pos+1] == '-') {
// comment // comment
pos += 2; pos += 2;
@ -3778,16 +3778,16 @@ class Document : FileResource {
// I'll just keep running until --> since that's the common way // I'll just keep running until --> since that's the common way
auto commentStart = pos; auto commentStart = pos;
while(pos+3 < data.length && data[pos..pos+3] != "-->") while(pos+3 < data.length() && data[pos..pos+3] != "-->")
pos++; pos++;
auto end = commentStart; auto end = commentStart;
if(pos + 3 >= data.length) { if(pos + 3 >= data.length()) {
if(strict) if(strict)
throw new MarkupException("unclosed comment"); throw new MarkupException("unclosed comment");
end = data.length; end = data.length();
pos = data.length; pos = data.length();
} else { } else {
end = pos; end = pos;
assert(data[pos] == '-'); assert(data[pos] == '-');
@ -3802,7 +3802,7 @@ class Document : FileResource {
if(parseSawComment(data[commentStart .. end])) { if(parseSawComment(data[commentStart .. end])) {
return Ele(3, new HtmlComment(this, data[commentStart .. end]), null); return Ele(3, new HtmlComment(this, data[commentStart .. end]), null);
} }
} else if(pos + 7 <= data.length && data[pos..pos + 7] == "[CDATA[") { } else if(pos + 7 <= data.length() && data[pos..pos + 7] == "[CDATA[") {
pos += 7; pos += 7;
auto cdataStart = pos; auto cdataStart = pos;
@ -3810,7 +3810,7 @@ class Document : FileResource {
ptrdiff_t end = -1; ptrdiff_t end = -1;
typeof(end) cdataEnd; typeof(end) cdataEnd;
if(pos < data.length) { if(pos < data.length()) {
// cdata isn't allowed to nest, so this should be generally ok, as long as it is found // cdata isn't allowed to nest, so this should be generally ok, as long as it is found
end = data[pos .. $].indexOf("]]>"); end = data[pos .. $].indexOf("]]>");
} }
@ -3828,9 +3828,9 @@ class Document : FileResource {
return Ele(0, new TextNode(this, data[cdataStart .. cdataEnd]), null); return Ele(0, new TextNode(this, data[cdataStart .. cdataEnd]), null);
} else { } else {
auto start = pos; auto start = pos;
while(pos < data.length && data[pos] != '>') while(pos < data.length() && data[pos] != '>')
pos++; 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 >
@ -3889,7 +3889,7 @@ class Document : FileResource {
more: more:
pos++; // skip the start pos++; // skip the start
if(pos == data.length) { if(pos == data.length()) {
if(strict) if(strict)
throw new MarkupException("Unclosed <"~end~" by end of file"); throw new MarkupException("Unclosed <"~end~" by end of file");
} else { } else {
@ -3919,8 +3919,8 @@ class Document : FileResource {
auto code = data[started .. pos]; auto code = data[started .. pos];
assert((pos < data.length && data[pos] == '>') || (!strict && pos == data.length)); assert((pos < data.length() && data[pos] == '>') || (!strict && pos == data.length()));
if(pos < data.length) if(pos < data.length())
pos++; // get past the > pos++; // get past the >
if(isAsp && parseSawAspCode !is null) { if(isAsp && parseSawAspCode !is null) {
@ -3940,10 +3940,10 @@ class Document : FileResource {
case '/': // closing an element case '/': // closing an element
pos++; // skip the start pos++; // skip the start
auto p = pos; auto p = pos;
while(pos < data.length && data[pos] != '>') while(pos < data.length() && data[pos] != '>')
pos++; pos++;
//writefln("</%s>", data[p..pos]); //writefln("</%s>", data[p..pos]);
if(pos == data.length && data[pos-1] != '>') { if(pos == data.length() && data[pos-1] != '>') {
if(strict) if(strict)
throw new MarkupException("File ended before closing tag had a required >"); throw new MarkupException("File ended before closing tag had a required >");
else else
@ -3953,7 +3953,7 @@ class Document : FileResource {
string tname = data[p..pos-1]; string tname = data[p..pos-1];
if(!caseSensitive) if(!caseSensitive)
tname = tname.toLower; tname = tname.toLower();
return Ele(1, null, tname); // closing tag reports itself here return Ele(1, null, tname); // closing tag reports itself here
case ' ': // assume it isn't a real element... case ' ': // assume it isn't a real element...
@ -4006,7 +4006,7 @@ class Document : FileResource {
if(!selfClosed) if(!selfClosed)
selfClosed = tagName.isInArray(selfClosedElements); selfClosed = tagName.isInArray(selfClosedElements);
while(pos < data.length && data[pos] != '>') while(pos < data.length() && data[pos] != '>')
pos++; pos++;
} }
@ -4029,13 +4029,13 @@ class Document : FileResource {
if(!selfClosed) { if(!selfClosed) {
string closer = "</" ~ tagName ~ ">"; string closer = "</" ~ tagName ~ ">";
ptrdiff_t ending; ptrdiff_t ending;
if(pos >= data.length) if(pos >= data.length())
ending = -1; ending = -1;
else else
ending = indexOf(data[pos..$], closer); ending = indexOf(data[pos..$], closer);
if(loose && ending == -1 && pos < data.length) 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) {
if(strict) if(strict)
throw new Exception("tag " ~ tagName ~ " never closed"); throw new Exception("tag " ~ tagName ~ " never closed");
@ -4147,7 +4147,7 @@ class Document : FileResource {
} }
// if a tag was opened but not closed by end of file, we can arrive here // if a tag was opened but not closed by end of file, we can arrive here
if(!strict && pos >= data.length) if(!strict && pos >= data.length())
return addTag(false); return addTag(false);
//else if(strict) assert(0); // should be caught before //else if(strict) assert(0); // should be caught before
@ -4165,7 +4165,7 @@ class Document : FileResource {
eatWhitespace(); eatWhitespace();
// same deal as above the switch.... // same deal as above the switch....
if(!strict && pos >= data.length) if(!strict && pos >= data.length())
return addTag(false); return addTag(false);
switch(data[pos]) { switch(data[pos]) {
@ -4176,7 +4176,7 @@ 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(pos >= data.length()) {
if(strict) if(strict)
assert(0, "this should have thrown in readAttributeName"); assert(0, "this should have thrown in readAttributeName");
else { else {
@ -4194,11 +4194,11 @@ class Document : FileResource {
if(strict && attrName in attributes) if(strict && attrName in attributes)
throw new MarkupException("Repeated attribute: " ~ attrName); throw new MarkupException("Repeated attribute: " ~ attrName);
if(attrName.strip.length) if(attrName.strip().length)
attributes[attrName] = attrValue; attributes[attrName] = attrValue;
else if(strict) throw new MarkupException("wtf, zero length attribute name"); else if(strict) throw new MarkupException("wtf, zero length attribute name");
if(!strict && pos < data.length && data[pos] == '<') { if(!strict && pos < data.length() && data[pos] == '<') {
// this is the broken tag that doesn't have a > at the end // this is the broken tag that doesn't have a > at the end
data = data[0 .. pos] ~ ">" ~ data[pos.. $]; data = data[0 .. pos] ~ ">" ~ data[pos.. $];
// let's insert one as a hack // let's insert one as a hack
@ -4217,7 +4217,7 @@ class Document : FileResource {
eatWhitespace(); eatWhitespace();
Ele r; Ele r;
do { do {
r = readElement; // there SHOULD only be one element... r = readElement(); // there SHOULD only be one element...
if(r.type == 3 && r.element !is null) if(r.type == 3 && r.element !is null)
piecesBeforeRoot ~= r.element; piecesBeforeRoot ~= r.element;
@ -4250,7 +4250,7 @@ class Document : FileResource {
if(ele.tagName == "p" && ele.parentNode.tagName == ele.tagName) { if(ele.tagName == "p" && ele.parentNode.tagName == ele.tagName) {
auto shouldBePreviousSibling = ele.parentNode; auto shouldBePreviousSibling = ele.parentNode;
auto holder = shouldBePreviousSibling.parentNode; // this is the two element's mutual holder... auto holder = shouldBePreviousSibling.parentNode; // this is the two element's mutual holder...
holder.insertAfter(shouldBePreviousSibling, ele.removeFromTree); holder.insertAfter(shouldBePreviousSibling, ele.removeFromTree());
iterator.currentKilled(); // the current branch can be skipped; we'll hit it soon anyway since it's now next up. iterator.currentKilled(); // the current branch can be skipped; we'll hit it soon anyway since it's now next up.
} }
} }
@ -4287,7 +4287,7 @@ class Document : FileResource {
} }
if(e) if(e)
e.innerText = t; e.innerText(t);
} }
// FIXME: would it work to alias root this; ???? might be a good idea // FIXME: would it work to alias root this; ???? might be a good idea
@ -4490,7 +4490,7 @@ class Document : FileResource {
/// Specializes Document for handling generic XML. (always uses strict mode, uses xml mime type and file header) /// Specializes Document for handling generic XML. (always uses strict mode, uses xml mime type and file header)
class XmlDocument : Document { class XmlDocument : Document {
this(string data) { this(string data) {
contentType = "text/xml; charset=utf-8"; contentType("text/xml; charset=utf-8");
_prolog = `<?xml version="1.0" encoding="UTF-8"?>` ~ "\n"; _prolog = `<?xml version="1.0" encoding="UTF-8"?>` ~ "\n";
parse(data, true, true); parse(data, true, true);
@ -4606,7 +4606,7 @@ int intFromHex(string hex) {
bool skip = false; bool skip = false;
// get rid of useless, non-syntax whitespace // get rid of useless, non-syntax whitespace
selector = selector.strip; selector = selector.strip();
selector = selector.replace("\n", " "); // FIXME hack selector = selector.replace("\n", " "); // FIXME hack
selector = selector.replace(" >", ">"); selector = selector.replace(" >", ">");
@ -5174,7 +5174,7 @@ int intFromHex(string hex) {
} }
} }
commit; commit();
return s; return s;
} }
@ -5203,8 +5203,8 @@ Element[] removeDuplicates(Element[] input) {
class CssStyle { class CssStyle {
///. ///.
this(string rule, string content) { this(string rule, string content) {
rule = rule.strip; rule = rule.strip();
content = content.strip; content = content.strip();
if(content.length == 0) if(content.length == 0)
return; return;
@ -5213,7 +5213,7 @@ class CssStyle {
originatingSpecificity = getSpecificityOfRule(rule); // FIXME: if there's commas, this won't actually work! originatingSpecificity = getSpecificityOfRule(rule); // FIXME: if there's commas, this won't actually work!
foreach(part; content.split(";")) { foreach(part; content.split(";")) {
part = part.strip; part = part.strip();
if(part.length == 0) if(part.length == 0)
continue; continue;
auto idx = part.indexOf(":"); auto idx = part.indexOf(":");
@ -5223,8 +5223,8 @@ class CssStyle {
Property p; Property p;
p.name = part[0 .. idx].strip; p.name = part[0 .. idx].strip();
p.value = part[idx + 1 .. $].replace("! important", "!important").replace("!important", "").strip; // FIXME don't drop important p.value = part[idx + 1 .. $].replace("! important", "!important").replace("!important", "").strip(); // FIXME don't drop important
p.givenExplicitly = true; p.givenExplicitly = true;
p.specificity = originatingSpecificity; p.specificity = originatingSpecificity;
@ -5297,7 +5297,7 @@ class CssStyle {
value = value.replace("! important", "!important"); value = value.replace("! important", "!important");
if(value.indexOf("!important") != -1) { if(value.indexOf("!important") != -1) {
newSpecificity.important = 1; // FIXME newSpecificity.important = 1; // FIXME
value = value.replace("!important", "").strip; value = value.replace("!important", "").strip();
} }
foreach(ref property; properties) foreach(ref property; properties)
@ -5613,7 +5613,7 @@ final class ElementStream {
/// You should call this when you remove an element from the tree. It then doesn't recurse into that node and adjusts the current position, keeping the range stable. /// You should call this when you remove an element from the tree. It then doesn't recurse into that node and adjusts the current position, keeping the range stable.
void currentKilled() { void currentKilled() {
if(stack.empty) // should never happen if(stack.empty()) // should never happen
isEmpty = true; isEmpty = true;
else { else {
current = stack.pop(); current = stack.pop();
@ -5754,7 +5754,7 @@ class Event {
isBubbling = false; isBubbling = false;
foreach(e; chain.retro) { foreach(e; chain.retro()) {
if(eventName in e.capturingEventHandlers) if(eventName in e.capturingEventHandlers)
foreach(handler; e.capturingEventHandlers[eventName]) foreach(handler; e.capturingEventHandlers[eventName])
handler(e, this); handler(e, this);