私は、すべての子<img>
タグを取り、src
属性を取得し、背景が前述のソースである子リスト要素を持つ順序付けられていないリストを作成するウィジェットを作成しています。しかし、リスト要素を作成し、dojo にそれらを master 内に配置するように指示すると<ul>
、それらは外に出てしまいます。このウィジェットは、次に示すように、チェーンの 3 番目です。
+ ImageBox
++ AnimImageBox
++ SlideImageBox
+++ AnimSlideImageBox (TBA)
マスター リストの作成:
buildRendering : function(){
this.inherited(arguments);
// Create the slidebox <ul>
this.slideHolder = domConstruct.create('ul', {
className : 'imagebox-slide'
}, this.domNode, 'first');
}
これは_lazyLoad
メソッドのブロックです。これはもともとルートImageBox
クラスで定義されており、ここでオーバーライドされ、 inside と呼ばれますpostCreate()
。
var self = this;
query('img', this.domNode).forEach(function(image){
// With each found image, push the src attribute into our class-wide array
var src = domAttr.get(image, 'src');
self.images.push(src);
// Create an <li> for the slide block
var li = domConstruct.create('li', {
className : 'slide'
}, self.slideHolder);
// Destroy the <img /> element
domConstruct.destroy(image);
});
クラス構造/メソッド呼び出しの概要:
ImageBox.js
buildRendering():
- Creates the preloader
postCreate():
+ Calls _lazyLoad to extract image data, load, show progress, etc.
SlideImageBox.js (私が問題を抱えているもの)
buildRendering():
- Calls the superclass method, and then creates the <ul> element, placing to this.domNode
postCreate():
- Just calls the superclass postCreate() method (via this.inherited(args))
_lazyLoad():
- Overridden completely, is called correctly as tested with various log() calls.
期待される結果
<ul class="imagebox-slide">
<li class="slide"><!--Content --></li>
<li class="slide"><!--Content --></li>
<li class="slide"><!--Content --></li>
</ul>
結果
<ul class="imagebox-slide"></ul>
<li class="slide"><!--Content --></li>
<li class="slide"><!--Content --></li>
<li class="slide"><!--Content --></li>
すべてのステップlog()
でノードができるので、それらが存在することはわかっていますが、domConstruct.create()
行はそれらをノードに入れていません。このような道場は何度も扱っているので、どこかで私の遺産と関係があるのでしょうか?
たぶん手遅れで新鮮な目が必要なのか、それとも何か他のことがここで働いているのでしょうか?
編集
@DavidMcMullin、place
私が問題を抱えていた呼び出しは暗黙のうちに呼び出されcreate
ます。申し訳ありませんが、その点を強調しませんでした。
@Frode、他の2つの.jsファイルからの継承が必要です。設定方法を知るのに十分なほどフィドラーを使用していませんが、調べます。
@Stephen、それだけで、どういうわけか、ステートメントがそうではないことを私に伝えていたにもかかわらず、作成順序がオフであったことが判明し、log()
私はそれを試したと思いました...対応するために少しリファクタリングする必要がありますメソッドがスーパークラスで呼び出されましたが、今はうまくいっています。答えを入れて、私は受け入れます。