bool DatasetDOMStringMap::contains(const String& name)
{
    AttributeCollection attributes = m_element->attributes();
    for (const Attribute& attr : attributes) {
        if (propertyNameMatchesAttributeName(name, attr.localName()))
            return true;
    }
    return false;
}
static bool propertyNameMatchesAttributeName(const String& propertyName, const String& attributeName)
{
    if (!attributeName.startsWith("data-"))
        return false;

    unsigned propertyLength = propertyName.length();
    unsigned attributeLength = attributeName.length();

    if (propertyName.is8Bit()) {
        if (attributeName.is8Bit())
            return propertyNameMatchesAttributeName(propertyName.characters8(), attributeName.characters8(), propertyLength, attributeLength);
        return propertyNameMatchesAttributeName(propertyName.characters8(), attributeName.characters16(), propertyLength, attributeLength);
    }

    if (attributeName.is8Bit())
        return propertyNameMatchesAttributeName(propertyName.characters16(), attributeName.characters8(), propertyLength, attributeLength);
    return propertyNameMatchesAttributeName(propertyName.characters16(), attributeName.characters16(), propertyLength, attributeLength);
}
String DatasetDOMStringMap::item(const String& name)
{
    AttributeCollection attributes = m_element->attributes();
    for (const Attribute& attr : attributes) {
        if (propertyNameMatchesAttributeName(name, attr.localName()))
            return attr.value();
    }

    return String();
}
bool DatasetDOMStringMap::contains(const String& name)
{
    NamedNodeMap* attributeMap = m_element->attributes(true);
    if (attributeMap) {
        unsigned length = attributeMap->length();
        for (unsigned i = 0; i < length; i++) {
            Attribute* attribute = attributeMap->attributeItem(i);
            if (propertyNameMatchesAttributeName(name, attribute->localName()))
                return true;
        }
    }
    return false;
}
Пример #5
0
bool DatasetDOMStringMap::contains(const String& name)
{
    if (!m_element->hasAttributes())
        return false;

    AttributeIteratorAccessor attributes = m_element->attributesIterator();
    AttributeConstIterator end = attributes.end();
    for (AttributeConstIterator it = attributes.begin(); it != end; ++it) {
        if (propertyNameMatchesAttributeName(name, it->localName()))
            return true;
    }
    return false;
}
Пример #6
0
bool DatasetDOMStringMap::contains(const String& name)
{
    if (!m_element.hasAttributes())
        return false;

    unsigned length = m_element.attributeCount();
    for (unsigned i = 0; i < length; i++) {
        const Attribute& attribute = m_element.attributeAt(i);
        if (propertyNameMatchesAttributeName(name, attribute.localName()))
            return true;
    }

    return false;
}
Пример #7
0
String DatasetDOMStringMap::item(const String& name)
{
    if (!m_element.hasAttributes())
        return String();

    unsigned length = m_element.attributeCount();
    for (unsigned i = 0; i < length; i++) {
        const Attribute& attribute = m_element.attributeAt(i);
        if (propertyNameMatchesAttributeName(name, attribute.localName()))
            return attribute.value();
    }

    return String();
}
Пример #8
0
String DatasetDOMStringMap::item(const String& name)
{
    if (!m_element->hasAttributes())
        return String();

    AttributeIteratorAccessor attributes = m_element->attributesIterator();
    AttributeConstIterator end = attributes.end();
    for (AttributeConstIterator it = attributes.begin(); it != end; ++it) {
        if (propertyNameMatchesAttributeName(name, it->localName()))
            return it->value();
    }

    return String();
}