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

hover effect is missing after replaceWith #94

Open
lzl124631x opened this issue Mar 1, 2015 · 2 comments
Open

hover effect is missing after replaceWith #94

lzl124631x opened this issue Mar 1, 2015 · 2 comments

Comments

@lzl124631x
Copy link

// html

            <html xmlns="http://www.w3.org/1999/xhtml">
            <head>
                <meta http-equiv="X-UA-Compatible" content="IE=7" />
                <title></title>
                <link type="text/css" href="changeElement-hover.css" rel="stylesheet" />
                <script type="text/javascript" src="Scripts/jquery-1.11.1.min.js"></script>
                <script type="text/javascript" src="Scripts/selectivizr-min.js"></script>
                <script>
                    $(function () {
                        function updateText() {
                            $(this).text('newnewnewnewnewnewnewnewnewnewnew');
                        }

                        function updateBox() {
                            $(this).replaceWith($('<span class="box">newnewnewnewnewnewnewnewnewnewnew. </span>'));
                        }

                        $('.box').click(updateBox);
                    })
                </script>
            </head>
            <body>
                <span class="box">oldoldoldoldoldoldoldoldoldoldoldoldoldold. </span><span class="box">oldoldoldoldoldoldoldoldoldoldoldoldoldold. </span>
            </body>
            </html>

// css

        .box {
            cursor: pointer;
            font-style: italic;
        }

            .box:hover {
                background-color: yellow;
            }

            .box:last-child {
                color: red;
            }

The above code illustrates a bug: after new element substitutes the old one by replaceWith, the hover effect is missing.

@lzl124631x
Copy link
Author

In a word, inserted elements can't have hover effect (maybe it's because it won't be added 'slvzr-hover' to it).

@lzl124631x
Copy link
Author

This severely affects dynamic webpages.

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