mnater / Hyphenopoly

Hyphenation for node and Polyfill for client-side hyphenation.
http://mnater.github.io/Hyphenopoly/
MIT License
694 stars 44 forks source link

On resizing breaks and removes p tag #142

Closed MarkoMiloshevic closed 4 years ago

MarkoMiloshevic commented 4 years ago

I'm having a problem with hyphenopoly when resizing content, it remove the p tag and adds few more hyphens do you know maybe what's wrong? The content of the hyphenopoly is like this:

<script>
var mainLang = document.querySelectorAll('html')[0];
var mainAttr = mainLang.getAttribute('lang');
if (mainAttr == 'DE') {
    var Hyphenopoly = {
        require: {
            "de": "FORCEHYPHENOPOLY",
        },
        paths: {
            maindir: "/static/vendor/hyphen/",
            patterndir: "/static/vendor/hyphen/patterns/"
        },
        setup: {
            selectors: {
                "html": {}
            }
        }
    };
} else if (mainAttr == 'EN') {
    var Hyphenopoly = {
        require: {
            "en-gb": "FORCEHYPHENOPOLY",
        },
        paths: {
            maindir: "/static/vendor/hyphen/",
            patterndir: "/static/vendor/hyphen/patterns/"
        },
        setup: {
            selectors: {
                "html": {}
            }
        }
    };
} else if (mainAttr == 'FR') {
    var Hyphenopoly = {
        require: {
            "fr": "FORCEHYPHENOPOLY",
        },
        paths: {
            maindir: "/static/vendor/hyphen/",
            patterndir: "/static/vendor/hyphen/patterns/"
        },
        setup: {
            selectors: {
                "html": {}
            }
        }
    };
}
</script>

It is placed in head of the website. Also what i've noticed it only does that on that particular element, everything else is fine.

Screenshot 2020-08-22 at 18 36 56
mnater commented 4 years ago

Hi

With this information it is difficult to understand the problem.

Hyphenopoly does not actually change the DOM structure of the document. That means it does not delete any tags. It only changes the text content of the elements by inserting soft hyphens.

The Hyphenopoly configuration seems to be correct (even if it is a bit strangely designed).

I'm not sure if this is really a problem of Hyphenopoly or if another script interferes.

I would like to be able to reproduce the problem somehow so that I can solve it eventually:

Best regards, Mathias

MarkoMiloshevic commented 4 years ago

Yeah it wasn't hyphenopoly problem. Found a script that is conflicting with those. Thanks for assistance!