fixes and convenience methods

This commit is contained in:
Adam D. Ruppe 2011-09-15 23:35:13 -04:00
parent ad98c2cbb1
commit 9d7665398f
2 changed files with 22 additions and 2 deletions

4
cgi.d
View File

@ -922,7 +922,7 @@ string[string] decodeVariablesSingle(string data) {
return va;
}
string encodeVariables(string[string] data) {
string encodeVariables(in string[string] data) {
string ret;
bool outputted = false;
@ -938,7 +938,7 @@ string encodeVariables(string[string] data) {
return ret;
}
string encodeVariables(string[][string] data) {
string encodeVariables(in string[][string] data) {
string ret;
bool outputted = false;

20
dom.d
View File

@ -1165,6 +1165,24 @@ class Element {
this.children.length = 0; // we reparented them all above
}
/// shorthand for this.parentNode.removeChild(this) with parentNode null check
Element removeFromTree()
in {
}
out(var) {
assert(this.parentNode is null);
assert(var is this);
}
body {
if(this.parentNode is null)
return this;
this.parentNode.removeChild(this);
return this;
}
Element replaceWith(Element e) {
if(e.parentNode !is null)
e.parentNode.removeChild(e);
@ -1348,6 +1366,8 @@ dchar parseEntity(in dchar[] entity) {
case "deg":
case "micro"
*/
case "hellip":
return '\u2026';
case "laquo":
return '\u00ab';
case "raquo":