6
JavaScript関数のエイリアシングが機能していないようです
私はこの質問を読んでいて、function-wrapperメソッドではなくaliasメソッドを試したかったのですが、Firefox 3または3.5beta4、あるいはGoogleChromeのデバッグウィンドウとGoogleChromeの両方で動作させることができなかったようです。テストWebページで。 Firebug: >>> window.myAlias = document.getElementById function() >>> myAlias('item1') >>> window.myAlias('item1') >>> document.getElementById('item1') <div id="item1"> これをWebページに配置すると、myAliasを呼び出すと次のエラーが発生します。 uncaught exception: [Exception... "Illegal operation on WrappedNative prototype object" nsresult: "0x8057000c (NS_ERROR_XPC_BAD_OP_ON_WN_PROTO)" location: "JS frame :: file:///[...snip...]/test.html :: <TOP_LEVEL> :: line 7" data: no] Chrome(わかりやすくするために>>>が挿入されています): >>> window.myAlias = document.getElementById function getElementById() { [native …