void HTMLMenuItemElement::defaultEventHandler(Event* event) { if (event->type() == EventTypeNames::click) { if (equalIgnoringCase(fastGetAttribute(typeAttr), "checkbox")) { if (fastHasAttribute(checkedAttr)) removeAttribute(checkedAttr); else setAttribute(checkedAttr, "checked"); } else if (equalIgnoringCase(fastGetAttribute(typeAttr), "radio")) { if (Element* parent = parentElement()) { AtomicString group = fastGetAttribute(radiogroupAttr); for (HTMLMenuItemElement& menuItem : Traversal<HTMLMenuItemElement>::childrenOf(*parent)) { if (!menuItem.fastHasAttribute(checkedAttr)) continue; const AtomicString& groupAttr = menuItem.fastGetAttribute(radiogroupAttr); if (equalIgnoringNullity(groupAttr.impl(), group.impl())) menuItem.removeAttribute(checkedAttr); } } setAttribute(checkedAttr, "checked"); } event->setDefaultHandled(); } }
void HTMLTextFormControlElement::dispatchFormControlChangeEvent() { if (!equalIgnoringNullity(m_textAsOfLastFormControlChangeEvent, value())) { dispatchChangeEvent(); setTextAsOfLastFormControlChangeEvent(value()); } setChangedSinceLastFormControlChangeEvent(false); }
static bool findAttributeWithName(const HTMLToken& token, const QualifiedName& name, size_t& indexOfMatchingAttribute) { // Notice that we're careful not to ref the StringImpl here because we might be on a background thread. const String& attrName = name.namespaceURI() == XLinkNames::xlinkNamespaceURI ? "xlink:" + name.localName().string() : name.localName().string(); for (size_t i = 0; i < token.attributes().size(); ++i) { if (equalIgnoringNullity(token.attributes().at(i).name, attrName)) { indexOfMatchingAttribute = i; return true; } } return false; }
void JSLocation::setHash(ExecState* exec, JSValue value) { Frame* frame = impl()->frame(); ASSERT(frame); KURL url = frame->loader()->url(); String oldFragmentIdentifier = url.fragmentIdentifier(); String str = value.toString(exec); if (str.startsWith("#")) str = str.substring(1); if (equalIgnoringNullity(oldFragmentIdentifier, str)) return; url.setFragmentIdentifier(str); navigateIfAllowed(exec, frame, url, !frame->script()->anyPageIsProcessingUserGesture(), false); }
void Location::setHash(LocalDOMWindow* callingWindow, LocalDOMWindow* enteredWindow, const String& hash) { if (!m_frame) return; KURL url = m_frame->document()->url(); String oldFragmentIdentifier = url.fragmentIdentifier(); String newFragmentIdentifier = hash; if (hash[0] == '#') newFragmentIdentifier = hash.substring(1); url.setFragmentIdentifier(newFragmentIdentifier); // Note that by parsing the URL and *then* comparing fragments, we are // comparing fragments post-canonicalization, and so this handles the // cases where fragment identifiers are ignored or invalid. if (equalIgnoringNullity(oldFragmentIdentifier, url.fragmentIdentifier())) return; setLocation(url.string(), callingWindow, enteredWindow); }
bool HTMLTextFormControlElement::shouldDispatchFormControlChangeEvent(String& oldValue, String& newValue) { return !equalIgnoringNullity(oldValue, newValue); }
bool InputType::shouldDispatchFormControlChangeEvent(String& oldValue, String& newValue) { return !equalIgnoringNullity(oldValue, newValue); }
bool threadSafeMatch(const Vector<UChar, inlineCapacity>& vector, const QualifiedName& qname) { return equalIgnoringNullity(vector, qname.localName().impl()); }