Sharrre icon indicating copy to clipboard operation
Sharrre copied to clipboard

Updating total count should reuse template

Open hejmartin opened this issue 12 years ago • 1 comments

Hi

I'm using Sharrre in conjunction with CSS3PIE [1] which inserts VML-nodes in the DOM at render. When the simulateClick()-method in Sharre executes, it fetches the current html of the button using jQuery's .html()-method. This causes any such non-standard VML-nodes to be reinserted in the DOM as pure text nodes when the new html with the updated counter is inserted.

If instead the simulateClick()-method just increments the counter and calls the renderer()-method, rewriting the entire button based on the supplied (or default) template, the VML-nodes will disappear from the DOM and then they'll be created again once the new button is created.

My suggestion is that the simulateClick()-method should look as follows:

Plugin.prototype.simulateClick = function () { // Update counter total this.options.total++; this.renderer(); };

But maybe I'm missing something? What do you think? Thanks for a great plugin, by the way :)

[1] www.css3pie.com, a plugin allowing some CSS3 effects to be rendered in older versions of IE

hejmartin avatar Jun 07 '12 12:06 hejmartin

Totally agree with you, i will look into it.

smeeckaert avatar Feb 29 '16 12:02 smeeckaert