mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
proper html id attribute semantics
#WEB-369 fixed
This commit is contained in:
@@ -105,10 +105,24 @@ public class XmlRefCountHolder {
|
||||
myId2AttributeListMap.put(id, list);
|
||||
}
|
||||
else if (!soft) {
|
||||
final boolean html = HtmlUtil.isHtmlFile(attributeValue);
|
||||
final boolean html5 = HtmlUtil.isHtml5Context(attributeValue);
|
||||
|
||||
// mark as duplicate
|
||||
List<XmlAttributeValue> notSoft = ContainerUtil.mapNotNull(list, new NullableFunction<Pair<XmlAttributeValue, Boolean>, XmlAttributeValue>() {
|
||||
@Override
|
||||
public XmlAttributeValue fun(Pair<XmlAttributeValue, Boolean> pair) {
|
||||
if (html5 && !"id".equalsIgnoreCase(((XmlAttribute)pair.first.getParent()).getName())) {
|
||||
// according to HTML 5 (http://www.w3.org/TR/html5/dom.html#the-id-attribute) spec
|
||||
// only id attribute is unique identifier
|
||||
return null;
|
||||
}
|
||||
if (html && pair.first.getParent().getParent() == attributeValue.getParent().getParent()) {
|
||||
// according to HTML 4 (http://www.w3.org/TR/html401/struct/global.html#adef-id,
|
||||
// http://www.w3.org/TR/html401/struct/links.html#h-12.2.3) spec id and name occupy
|
||||
// same namespace, but having same values on one tag is ok
|
||||
return null;
|
||||
}
|
||||
return pair.second ? null : pair.first;
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user