Skip to content

Instantly share code, notes, and snippets.

@ww24
Last active August 29, 2015 14:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ww24/479804935b724b615b3f to your computer and use it in GitHub Desktop.
Save ww24/479804935b724b615b3f to your computer and use it in GitHub Desktop.
.lightgray 要素の前に半角空白を挿入し、 .lightgray 要素を削除する。
/**
* コピペ防止対策☆
*/
var fakes = [].slice.call(document.getElementsByClassName("lightgray")), fake;
while (fake = fakes.shift()) {
fake.parentNode.insertBefore(document.createTextNode(" "), fake);
fake.parentNode.removeChild(fake);
}
@ww24
Copy link
Author

ww24 commented Jun 4, 2014

メモ: 途中で要素数が変わる処理の場合、 Array#forEach では全ての要素が走査されない問題が現れる

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment