Giter Club home page Giter Club logo

inlinesvg's People

Contributors

createlogic avatar unclechu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

inlinesvg's Issues

Add me to collaborators

Can you add me to collaborators list of this repo to maintain this project? I'll be glad to do some stuff about publish to bower, may be make some other improvements.

Please, add git-tags for versions

Please add git tag 'v1.0.0' for this commit: a4fc329
And please add git tag 'v1.1.0' for this pull request: #3

It's helps for using bower or other package manager by specific version.

Copying event listeners and adding a "done" callback

Love this plugin and want to contribute! Currently, any events attached to the tag that is being replaced are lost. In addition, there is no callback when the swap is completed. Sooo, I submit this additional code for your inspection and hopefully approval:
starting at line 31
....
// Remove any invalid XML tags as per http://validator.w3.org
$svg = $svg.removeAttr('xmlns:a');

    // NEW Copy any event listeners over 
    $.each($._data($img.get(0), 'events'), function() {
        // iterate registered handler of original
        $.each(this, function() {
            $svg.bind(this.type, this.handler);
        });
    });

            // Replace image with new SVG
            $img.replaceWith($svg);

    // NEW Pass along the "done" event from the "get"
    $svg.trigger("done", [$svg]);

.....

Events are not cloned to svg from img

When the image object gets replaced with the svg, any event listeners (eg. 'click', 'keydown', etc) that had been on the original image object are lost.

That could probably be solved with a one-liner before the swap:
$img.copyEventsTo($svg);

Untested though...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.