Skip to content
This repository was archived by the owner on Apr 10, 2025. It is now read-only.

HtmlElement::AttributeValue returns NULL ambiguity #247

Closed
GoogleCodeExporter opened this issue Apr 6, 2015 · 1 comment
Closed

HtmlElement::AttributeValue returns NULL ambiguity #247

GoogleCodeExporter opened this issue Apr 6, 2015 · 1 comment

Comments

@GoogleCodeExporter
Copy link

HtmlElement::AttributeValue("foo") returns NULL if either:
* no attribute "foo" exists or
* attribute foo has no value.

Code:
  // Look up attribute value by name.  NULL if no attribute exists.
  // Use this only if you don't intend to change the attribute value;
  // if you might change the attribute value, use FindAttribute instead
  // (this avoids a double lookup).
  const char* AttributeValue(HtmlName::Keyword name) const {
    const Attribute* attribute = FindAttribute(name);
    if (attribute != NULL) {
      return attribute->value();
    }
    return NULL;
  }

Code only documents no attribute case, so we should update that and make sure 
that we aren't depending upon the NULL meaning no attribute.

Original issue reported on code.google.com by [email protected] on 21 Mar 2011 at 6:33

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant