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

Add callback option to options object passed into class applier module #143

Closed
timdown opened this issue Mar 22, 2014 · 2 comments
Closed

Comments

@timdown
Copy link
Owner

timdown commented Mar 22, 2014

From timd...@gmail.com on December 29, 2012 18:26:55

Callback will be called whenever a new element is created and can be used, for example, to add unique ids to each element created

Original issue: http://code.google.com/p/rangy/issues/detail?id=143

@timdown
Copy link
Owner Author

timdown commented Mar 22, 2014

From timd...@gmail.com on July 25, 2013 16:15:12

Added an onElementCreate property to the options object passed into the rangy.createClassApplier() method. If present, onElementCreate should be a function; it is passed a reference to the newly created element.

Be aware that any changes to attributes made by this function may prevent Rangy from merging it with other elements.

Example:

var id = 0;
var applier = rangy.createClassApplier("someClass", {
onElementCreate: function(el) {
el.id = "rangySpan_" + (id++);
}
});

@timdown
Copy link
Owner Author

timdown commented Mar 22, 2014

From maxwell....@gmail.com on July 28, 2013 06:17:10

This is great, Tim! It's working beautifully for me.

@timdown timdown closed this as completed May 9, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant