Skip to content

インジケータのターゲットにwindowを指定するとエラーになる #294

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
fukudayasuo opened this issue Apr 3, 2014 · 1 comment
Assignees
Milestone

Comments

@fukudayasuo
Copy link

インジケータのターゲットにwindowオブジェクトを指定すると、以下のようなエラーが発生する。
Uncaught TypeError: Cannot call method 'createElement' of undefined

再現コードは以下の通り。

// h5.ui.indicatorを使った例
h5.ui.indicator(window).show(); // エラー

// コントローラのindicatorを使った例
h5.core.controller('body', {
    __name:'hoge',
    __ready: function(){
        this.indicator({target: window}).show();  // エラー
    }
});

インジケータの要素を生成するためのdocumentオブジェクトを、内部関数getDocument()を使ってターゲットが属するwindowのdocumentを取得している。しかし、getDocumentにwindowオブジェクトが来ることが想定されていないため、undefinedが返り、createElementの際にエラーが発生している。

@simdy simdy added the bug label Apr 3, 2014
@simdy simdy added this to the v1.1.10 milestone Apr 3, 2014
@simdy simdy added enhancement and removed bug labels May 9, 2014
fukudayasuo pushed a commit to hifive-labs/hifivemain that referenced this issue May 9, 2014
ポップアップウィンドウでインジケータを表示するテストは、タブレットとスマートフォンではスキップ(テストフィルタを指定)するようにしました。
fukudayasuo pushed a commit to hifive-labs/hifivemain that referenced this issue May 9, 2014
@simdy
Copy link
Member

simdy commented May 12, 2014

#305 の対応(getDocumentOf()で、windowが渡された場合にも正しくDocumentを返すようにする)に伴い、エラーは発生しなくなりました。

@simdy simdy closed this as completed May 12, 2014
fukudayasuo pushed a commit to hifive-labs/hifivemain that referenced this issue May 12, 2014
ポップアップウィンドウを使ったテストケースを1つにし、他はiframeを使ったテストにしました。
createIFrameElementはiframeのwindowオブジェクトをresolveで返すようにしました。
fukudayasuo pushed a commit to hifive-labs/hifivemain that referenced this issue May 12, 2014
iframe内のwindowにインジケータを表示するテストを追加しました。
hifive#310 テストコードで、ポップアップウィンドウ内の要素のスタイルを取得するコードをcss()メソッドを使わないよう修正しました。
(style.displayを取得するように変更したことで、computedStyleは取得できていませんが、現時点での実装ではインジケータはインジケータ要素のdisplayをblockにして表示しているため、style.displayで確認しています。)
fukudayasuo pushed a commit to hifive-labs/hifivemain that referenced this issue May 12, 2014
getComputedStyleValueをテストコードに持ってきて、テストでのポップアップウィンドウ内の要素のスタイル取得はその関数を使用するようにしました。
fukudayasuo pushed a commit to hifive-labs/hifivemain that referenced this issue May 12, 2014
getComputedStyleWrapper -> getComputedStyleObject
fukudayasuo pushed a commit to hifive-labs/hifivemain that referenced this issue May 13, 2014
テスト側に、getComputedStyleObjectで使用しているgetDocumentOf,getWindowOfDocumentを追加しました。
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants