Opened 6 years ago

Closed 6 years ago

#17448 closed defect (invalid)

Cannot Pass Dom into Constructor Function in Widget

Reported by: shoguniphicus Owned by:
Priority: undecided Milestone: tbd
Component: Dijit Version: 1.9.1
Keywords: Cc:
Blocked By: Blocking:

Description

I had no problem making custom widget and subsequently subclassing them to make even more modular classes. However, I notice when I pass in a dom reference into the constructor function such as,

var someInstance = new SomeClass?(domReference).placeAt(windows.body());

Doing this will results in weird widget dom being generated and inserted into windows. such as

<div id="js_custom_ui_modal_ProModalGallery_0" class="in modal-overflow" data-dojo-attach-point="modal" spellcheck="true" contenteditable="inherit" outertext="" outerhtml="&lt;li style=&quot;margin:2px;&quot; data-index=&quot;0&quot; data-image-gallery=&quot;/assets/event_images/ff71e9eb49f8bb290cb7072458ac9a5c.jpg&quot; onclick=&quot;dojo.publish(&amp;quot;event.picture.clicked&amp;quot;, this);&quot;&gt;

&lt;img src=&quot;/assets/event_images/generated/135x135_ff71e9eb49f8bb290cb7072458ac9a5c.jpg&quot; title=&quot;&quot; style=&quot;padding:0;&quot; alt=&quot;&quot;&gt; &lt;/li&gt;" innertext="" accesskey="" webkitdropzone="" draggable="false" tabindex="-1" translate="yes" title="" childelementcount="1" lastelementchild="[object HTMLImageElement]" firstelementchild="[object HTMLImageElement]" children="[object HTMLCollection]" nextelementsibling="[object HTMLLIElement]" previouselementsibling="null" webkitshadowroot="null" webkitpseudo="" dataset="[object DOMStringMap]" classlist="" scrollheight="137" scrollwidth="137" scrolltop="0" scrollleft="0" clientheight="103" clientwidth="135" clienttop="0" clientleft="0" offsetparent="[object HTMLDivElement]" offsetheight="103" offsetwidth="135" offsettop="610" offsetleft="386" attributes="[object NamedNodeMap?]" tagname="LI" parentelement="[object HTMLUListElement]" textcontent="

" baseuri="http://something.com/" localname="li" prefix="null" namespaceuri="http://www.w3.org/1999/xhtml" nextsibling="[object Text]" previoussibling="[object Text]" lastchild="[object Text]" firstchild="[object Text]" childnodes="[object NodeList?]" parentnode="[object HTMLUListElement]" nodetype="1" nodevalue="null" nodename="LI" allow_keyboard_input="1" element_node="1" attribute_node="2" text_node="3" cdata_section_node="4" entity_reference_node="5" entity_node="6" processing_instruction_node="7" comment_node="8" document_node="9" document_type_node="10" document_fragment_node="11" notation_node="12" document_position_disconnected="1" document_position_preceding="2" document_position_following="4" document_position_contains="8" document_position_contained_by="16" document_position_implementation_specific="32" widgetid="js_custom_ui_modal_ProModalGallery_0" style="margin-top: 0px; margin-right: 2px; margin-bottom: 2px; left: 0px;" aria-hidden="false">

<img src="/assets/event_images/generated/135x135_ff71e9eb49f8bb290cb7072458ac9a5c.jpg" title="" style="padding:0;" alt=""> </div>

It feels like the rendering of the dom has ran into some problems when I do that, otherwise, if I have created my own constructor function and only pass in the dom after postCreate and I will have no problem making it works for me. I am just wondering is anyone else having the same problem? Is it a bug?

Change History (1)

comment:1 Changed 6 years ago by bill

Component: GeneralDijit
Resolution: invalid
Status: newclosed

No, I wouldn't consider it a bug. The signature for the widget constructor is new MyWidget(params, srcNodeRef), where params is a hash like {label: "hi", iconClass: "plusIcon"}. So if you start passing a DOMNode instead of a hash as the first parameter then surely you'll have problems.

Note: See TracTickets for help on using tickets.