void HTMLElement::parseAttribute(const QualifiedName& name, const AtomicString& value) { if (isIdAttributeName(name) || name == classAttr || name == styleAttr) return StyledElement::parseAttribute(name, value); if (name == dirAttr) dirAttributeChanged(value); else if (name == tabindexAttr) { int tabindex = 0; if (value.isEmpty()) clearTabIndexExplicitlyIfNeeded(); else if (parseHTMLInteger(value, tabindex)) { // Clamp tabindex to the range of 'short' to match Firefox's behavior. setTabIndexExplicitly(max(static_cast<int>(std::numeric_limits<short>::min()), min(tabindex, static_cast<int>(std::numeric_limits<short>::max())))); } #if ENABLE(MICRODATA) } else if (name == itempropAttr) { setItemProp(value); } else if (name == itemrefAttr) { setItemRef(value); } else if (name == itemtypeAttr) { setItemType(value); #endif } else { AtomicString eventName = eventNameForAttributeName(name); if (!eventName.isNull()) setAttributeEventListener(eventName, createAttributeEventListener(this, name, value)); } }
void HTMLElement::parseAttribute(const QualifiedName& name, const AtomicString& value) { if (isIdAttributeName(name) || name == classAttr || name == styleAttr) return Element::parseAttribute(name, value); if (name == dirAttr) dirAttributeChanged(value); else if (name == tabindexAttr) { int tabindex = 0; if (value.isEmpty()) { clearTabIndexExplicitlyIfNeeded(); if (treeScope().adjustedFocusedElement() == this) { // We might want to call blur(), but it's dangerous to dispatch // events here. document().setNeedsFocusedElementCheck(); } } else if (parseHTMLInteger(value, tabindex)) { // Clamp tabindex to the range of 'short' to match Firefox's behavior. setTabIndexExplicitly(max(static_cast<int>(std::numeric_limits<short>::min()), min(tabindex, static_cast<int>(std::numeric_limits<short>::max())))); } } else { const AtomicString& eventName = eventNameForAttributeName(name); if (!eventName.isNull()) setAttributeEventListener(eventName, createAttributeEventListener(this, name, value)); } }
int HTMLTextAreaElement::minLength() const { int value; if (!parseHTMLInteger(getAttribute(minlengthAttr), value)) return -1; return value >= 0 ? value : -1; }