Greasemonkeyの@requireとPrototype.jsの相性が悪いっぽい件
ちょっとマルチポストしてみるテスト。本家はこちら→http://exth.net/~togabito/wordpress/2008/06/24/1210/
Greasemonkeyの@requireがPrototype.jsを利用してちょっとしたハックをするのに便利そうだったので使ってみることにした。
とりあえず超ミニマムな実験をば。
// ==UserScript== // @name require sample // @namespace http://exth.net/~togabito/ // @include http://exth.net/~togabito/work/greasemonkey/test/* // @require http://www.prototypejs.org/assets/2008/1/25/prototype-1.6.0.2.js // ==/UserScript== function log(message) { document.title += message; GM_log(message); } (function(){ log("function"); var es = $('hoge').getElementsByClassName('fuga'); for(i=0; i<es.length; i++){ log("found"); es[i].style.backgroudColor = "red"; } if(i==0){ log("not found"); } })();
エラーコンソールにエラーとして「destination is undefined」が出て終わり。意味がわからん。
Firefox2でも試してみたが、同様にエラーとして「destination has no properties」が出る。やっぱり意味がわからん。
むかつくのでテストセットを作ってみた。こんなん
うん。駄目だ。意味がわからん。誰か何とかしてくれ!
普通に使いそうな組み合わせを持ち出したのにこの有様。私が壮大に何かを勘違いしているのか、それとも誰も使っていないのか。謎だ。