admin管理员组文章数量:1026989
<div style="display:none;">
<div id="wmd-editor" class="wmd-panel">
<div id="wmd-button-bar"></div>
<textarea id="wmd-input"></textarea>
</div>
<div id="wmd-preview" class="wmd-panel"></div>
<div id="wmd-output" class="wmd-panel"></div>
</div>
See,I'm following wmd-test.html of derobins-wmd,except put that stuff inside a hidden div.
uncaught exception: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIDOMNSHTMLTextAreaElement.selectionStart]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: http://localhost/derobins-wmd-980f687/wmd.js :: anonymous :: line 490" data: no]
uncaught exception: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIDOMNSHTMLTextAreaElement.selectionStart]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: http://localhost/derobins-wmd-980f687/wmd.js :: anonymous :: line 490" data: no]
<div style="display:none;">
<div id="wmd-editor" class="wmd-panel">
<div id="wmd-button-bar"></div>
<textarea id="wmd-input"></textarea>
</div>
<div id="wmd-preview" class="wmd-panel"></div>
<div id="wmd-output" class="wmd-panel"></div>
</div>
See,I'm following wmd-test.html of derobins-wmd,except put that stuff inside a hidden div.
uncaught exception: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIDOMNSHTMLTextAreaElement.selectionStart]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: http://localhost/derobins-wmd-980f687/wmd.js :: anonymous :: line 490" data: no]
uncaught exception: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIDOMNSHTMLTextAreaElement.selectionStart]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: http://localhost/derobins-wmd-980f687/wmd.js :: anonymous :: line 490" data: no]
Share
Improve this question
asked Oct 4, 2009 at 12:30
MisierMisier
1,5334 gold badges13 silver badges15 bronze badges
2 Answers
Reset to default 8In addition to hiding the whole panel with textarea inside of it, you need to make sure that textarea itself has display:none
and problems will disapear then. Otherwise wmd will not detect that textarea is not displaying and will try to do calculations on it and you will get exceptions like you said.
Simply putting elements off screen is not possible or at least very troublesome with some layouts. Furthermore, screenreaders will still detect those elements and accessibility will suffer.
I guess you solved the issue by now, but I hope it will help someone.
You might use the off-left technique, if the plugin doesn't like the elements not having height/width.
<div style="position: absolute; left: -1000px; width: 100px">
<div style="display:none;">
<div id="wmd-editor" class="wmd-panel">
<div id="wmd-button-bar"></div>
<textarea id="wmd-input"></textarea>
</div>
<div id="wmd-preview" class="wmd-panel"></div>
<div id="wmd-output" class="wmd-panel"></div>
</div>
See,I'm following wmd-test.html of derobins-wmd,except put that stuff inside a hidden div.
uncaught exception: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIDOMNSHTMLTextAreaElement.selectionStart]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: http://localhost/derobins-wmd-980f687/wmd.js :: anonymous :: line 490" data: no]
uncaught exception: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIDOMNSHTMLTextAreaElement.selectionStart]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: http://localhost/derobins-wmd-980f687/wmd.js :: anonymous :: line 490" data: no]
<div style="display:none;">
<div id="wmd-editor" class="wmd-panel">
<div id="wmd-button-bar"></div>
<textarea id="wmd-input"></textarea>
</div>
<div id="wmd-preview" class="wmd-panel"></div>
<div id="wmd-output" class="wmd-panel"></div>
</div>
See,I'm following wmd-test.html of derobins-wmd,except put that stuff inside a hidden div.
uncaught exception: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIDOMNSHTMLTextAreaElement.selectionStart]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: http://localhost/derobins-wmd-980f687/wmd.js :: anonymous :: line 490" data: no]
uncaught exception: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIDOMNSHTMLTextAreaElement.selectionStart]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: http://localhost/derobins-wmd-980f687/wmd.js :: anonymous :: line 490" data: no]
Share
Improve this question
asked Oct 4, 2009 at 12:30
MisierMisier
1,5334 gold badges13 silver badges15 bronze badges
2 Answers
Reset to default 8In addition to hiding the whole panel with textarea inside of it, you need to make sure that textarea itself has display:none
and problems will disapear then. Otherwise wmd will not detect that textarea is not displaying and will try to do calculations on it and you will get exceptions like you said.
Simply putting elements off screen is not possible or at least very troublesome with some layouts. Furthermore, screenreaders will still detect those elements and accessibility will suffer.
I guess you solved the issue by now, but I hope it will help someone.
You might use the off-left technique, if the plugin doesn't like the elements not having height/width.
<div style="position: absolute; left: -1000px; width: 100px">
本文标签: javascriptHow to hide wmd editor initiallyStack Overflow
版权声明:本文标题:javascript - How to hide wmd editor initially? - Stack Overflow 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://it.en369.cn/questions/1745656307a2161617.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论