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

Dynamic SVG changes #33

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Conversation

TheGr8Nik
Copy link

Hi,

I have made a version with the possibility to change dynamically the 'xlink:href' attribute

What do you think?

Regards,
Andrea

Changing of the 'xlink:href' attribute is watched trough the
MutationObserver if present or with the polling fallback.
Lowered polling time to 1s
@jonathantneal
Copy link
Owner

What you could do instead is hijack the setAttribute method, right?

@TheGr8Nik
Copy link
Author

Yes, it's a good idea! But is safe to change a methods?
On MDN I have read that you should not change a native method

this.cb_fn = cb_fn;
this.observed = [];

setInterval( this.checkAttributes.bind(this), 1000 );
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In IE8 you would need a Function.bind polyfill.

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

Successfully merging this pull request may close these issues.

3 participants