Create a gist now

Instantly share code, notes, and snippets.

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