salqueng / enterplz

Supporting word break for CJK ( Chinese, Japanese, Korean ) in browsers

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

enterplz

Supporting word break for CJK ( Chinese, Japanese, Korean ) in browsers which aren't support CSS property

word-break: keep-all;

( Internet Explorer is only supporting this property currently. )

enterplz is inpired by jquery-word-break-keep-all but there are some of bugs and it can't trail dynamic HTML which is made by Ajax or Websocket. Using MutationObserver, enterplz can track modified HTML and dynamically make word not break by lines enterplz

Usage

Just run like this.

enterplz.run({
  include: documnent.body, // root DOM node
  follow: true // Wheather tracking dynamic HTML or not
});

Prerequisite

This library is witten in ECMAScript 6 then transpiled to ES5 to be used in browsers ( Chrome, Firefox, Safari, ... ) There aren't many ES6 functions in web browsers, so it should be used with browser polyfill

Example

  • before

image

  • after

image

About

Supporting word break for CJK ( Chinese, Japanese, Korean ) in browsers

License:MIT License


Languages

Language:JavaScript 100.0%