Skip to content

HTMLAnchorTag doesn't support a.hash #36

@kennardconsulting

Description

@kennardconsulting

I get the feeling this project is long since abandoned, but I'll leave this here for what it's worth. It was a great project, BTW!

Env.js 1.2 doesn't support a.hash. That is, if you create an anchor tag, with an href, and then try to look it up via a.hash, it returns undefined. This code fixes that (albeit crudely):

HTMLElement.prototype.setAttribute = function(name, value) {
    //console.log("CSS set attribute: " + name + ", " + value);
    origSetAttribute.apply(this, arguments);
    if (name === "style") {
        updateCss2Props(this, value);
    }
    // Add support for 'HTMLAnchorTag.hash'
    if (this.tagName === "A" && name === "href" && value.indexOf( "#" ) !== -1 ) {
        this.hash = value.substring( value.indexOf( "#" ));
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions