mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 523089. Fix serialization of [*|foo] selectors. r=dbaron
This commit is contained in:
parent
4fe287e289
commit
74eef1d572
@ -651,17 +651,22 @@ nsCSSSelector::AppendToStringWithoutCombinatorsOrNegations
|
||||
while (list != nsnull) {
|
||||
aString.Append(PRUnichar('['));
|
||||
// Append the namespace prefix
|
||||
if (list->mNameSpace > 0) {
|
||||
if (list->mNameSpace == kNameSpaceID_Unknown) {
|
||||
aString.Append(PRUnichar('*'));
|
||||
aString.Append(PRUnichar('|'));
|
||||
} else if (list->mNameSpace != kNameSpaceID_None) {
|
||||
if (aSheet) {
|
||||
nsXMLNameSpaceMap *sheetNS = aSheet->GetNameSpaceMap();
|
||||
// will return null if namespace was the default
|
||||
nsIAtom *prefixAtom = sheetNS->FindPrefix(list->mNameSpace);
|
||||
if (prefixAtom) {
|
||||
nsAutoString prefix;
|
||||
prefixAtom->ToString(prefix);
|
||||
aString.Append(prefix);
|
||||
aString.Append(PRUnichar('|'));
|
||||
}
|
||||
// Default namespaces don't apply to attribute selectors, so
|
||||
// we must have a useful prefix.
|
||||
NS_ASSERTION(prefixAtom,
|
||||
"How did we end up with a namespace if the prefix "
|
||||
"is unknown?");
|
||||
nsAutoString prefix;
|
||||
prefixAtom->ToString(prefix);
|
||||
aString.Append(prefix);
|
||||
aString.Append(PRUnichar('|'));
|
||||
}
|
||||
}
|
||||
// Append the attribute name
|
||||
|
@ -398,6 +398,62 @@ function run() {
|
||||
function (doc) { return doc.getElementsByTagName("test");}
|
||||
);
|
||||
|
||||
test_selector_in_html(
|
||||
'@namespace url("test");',
|
||||
'*|*[foo]',
|
||||
'<test foo="bar"/>',
|
||||
function (doc) { return doc.getElementsByTagName("test");},
|
||||
function (doc) { return []; }
|
||||
);
|
||||
|
||||
test_selector_in_html(
|
||||
'@namespace url("test");',
|
||||
'*|*[|foo]',
|
||||
'<test foo="bar"/>',
|
||||
function (doc) { return doc.getElementsByTagName("test");},
|
||||
function (doc) { return []; }
|
||||
);
|
||||
|
||||
test_selector_in_html(
|
||||
'@namespace test url("test");',
|
||||
'*|*[test|foo]',
|
||||
'<test foo="bar"/>',
|
||||
function (doc) { return []; },
|
||||
function (doc) { return doc.getElementsByTagName("test");}
|
||||
);
|
||||
|
||||
test_selector_in_html(
|
||||
'@namespace test url("test");',
|
||||
'*|*[test|foo]',
|
||||
'<test xmlns:t="test" t:foo="bar"/>',
|
||||
function (doc) { return doc.getElementsByTagName("test");},
|
||||
function (doc) { return []; }
|
||||
);
|
||||
|
||||
test_selector_in_html(
|
||||
'@namespace url("test");',
|
||||
'*|*[foo]',
|
||||
'<test xmlns:t="test" t:foo="bar"/>',
|
||||
function (doc) { return []; },
|
||||
function (doc) { return doc.getElementsByTagName("test");}
|
||||
);
|
||||
|
||||
test_selector_in_html(
|
||||
'@namespace url("test");',
|
||||
'*|*[*|foo]',
|
||||
'<test xmlns:t="test" t:foo="bar"/>',
|
||||
function (doc) { return doc.getElementsByTagName("test");},
|
||||
function (doc) { return []; }
|
||||
);
|
||||
|
||||
test_selector_in_html(
|
||||
'',
|
||||
'*|*[*|foo]',
|
||||
'<test xmlns:t="test" t:foo="bar"/>',
|
||||
function (doc) { return doc.getElementsByTagName("test");},
|
||||
function (doc) { return []; }
|
||||
);
|
||||
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user