本文整理汇总了C++中HTMLFormControlElement::checkValidity方法的典型用法代码示例。如果您正苦于以下问题:C++ HTMLFormControlElement::checkValidity方法的具体用法?C++ HTMLFormControlElement::checkValidity怎么用?C++ HTMLFormControlElement::checkValidity使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HTMLFormControlElement
的用法示例。
在下文中一共展示了HTMLFormControlElement::checkValidity方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: isValidElement
bool HTMLFieldSetElement::isValidElement()
{
const FormAssociatedElement::List& elements = associatedElements();
for (unsigned i = 0; i < elements.size(); ++i) {
if (elements[i]->isFormControlElement()) {
HTMLFormControlElement* control = toHTMLFormControlElement(elements[i].get());
if (!control->checkValidity(0, CheckValidityDispatchNoEvent))
return false;
}
}
return true;
}
示例2: protector
bool HTMLFormElement::checkInvalidControlsAndCollectUnhandled(Vector<RefPtr<FormAssociatedElement> >* unhandledInvalidControls, HTMLFormControlElement::CheckValidityDispatchEvents dispatchEvents)
{
RefPtr<HTMLFormElement> protector(this);
// Copy m_associatedElements because event handlers called from
// HTMLFormControlElement::checkValidity() might change m_associatedElements.
Vector<RefPtr<FormAssociatedElement> > elements;
elements.reserveCapacity(m_associatedElements.size());
for (unsigned i = 0; i < m_associatedElements.size(); ++i)
elements.append(m_associatedElements[i]);
bool hasInvalidControls = false;
for (unsigned i = 0; i < elements.size(); ++i) {
if (elements[i]->form() == this && elements[i]->isFormControlElement()) {
HTMLFormControlElement* control = toHTMLFormControlElement(elements[i].get());
if (!control->checkValidity(unhandledInvalidControls, dispatchEvents) && control->formOwner() == this)
hasInvalidControls = true;
}
}
return hasInvalidControls;
}
示例3: protector
bool HTMLFormElement::checkInvalidControlsAndCollectUnhandled(WillBeHeapVector<RefPtrWillBeMember<HTMLFormControlElement>>* unhandledInvalidControls, CheckValidityEventBehavior eventBehavior)
{
RefPtrWillBeRawPtr<HTMLFormElement> protector(this);
// Copy associatedElements because event handlers called from
// HTMLFormControlElement::checkValidity() might change associatedElements.
const FormAssociatedElement::List& associatedElements = this->associatedElements();
WillBeHeapVector<RefPtrWillBeMember<FormAssociatedElement>> elements;
elements.reserveCapacity(associatedElements.size());
for (unsigned i = 0; i < associatedElements.size(); ++i)
elements.append(associatedElements[i]);
int invalidControlsCount = 0;
for (unsigned i = 0; i < elements.size(); ++i) {
if (elements[i]->form() == this && elements[i]->isFormControlElement()) {
HTMLFormControlElement* control = toHTMLFormControlElement(elements[i].get());
if (control->isSubmittableElement() && !control->checkValidity(unhandledInvalidControls, eventBehavior) && control->formOwner() == this) {
++invalidControlsCount;
if (!unhandledInvalidControls && eventBehavior == CheckValidityDispatchNoEvent)
return true;
}
}
}
return invalidControlsCount;
}