Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTMLAnchorTag doesn't support a.hash #36

Open
kennardconsulting opened this issue Jan 21, 2016 · 0 comments
Open

HTMLAnchorTag doesn't support a.hash #36

kennardconsulting opened this issue Jan 21, 2016 · 0 comments

Comments

@kennardconsulting
Copy link

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( "#" ));
    }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant