Skip to content

Instantly share code, notes, and snippets.

@hail2u hail2u/ellipsis-title.js
Last active Aug 7, 2017

Embed
What would you like to do?
`text-overflow: ellipsis`が指定されている要素の`title`属性へテキストを仕込む汎用スクリプト
/*!
* ellipsis-title.js
*
* LICENSE: http://hail2u.mit-license.org/2016
*/
"use strict";
(function () {
var e;
var i;
var l;
var n = document.querySelectorAll("*");
for (i = 0, l = n.length; i < l; i += 1) {
e = n[i];
if (window.getComputedStyle(e)["text-overflow"] === "ellipsis") {
e.title = e.textContent;
}
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.