Skip to content

some element transformations by jQuery within @dom annotated method causes exception #112

Open
@mcku

Description

@mcku

Problem:
Some transformations make dom.scala thinks it is inserting the element twice and throws an exception.

The element is here https://gist.github.com/glmars/a597f7c28931a38e2e9b3262279889a9#file-dropdown-initialize-scala-L17

Expected behavior: use the transformed element without a problem.

Exception: https://github.com/ThoughtWorksInc/Binding.scala/blob/v11.3.0/dom/src/main/scala/com/thoughtworks/binding/dom.scala#L106
Exception message is: "Cannot insert SELECT twice!"

Additional notes:
The <select>...</select> was being transformed into a <div>...</div> by jquery on the fly. and perhaps this is causing a singularity.

Here is the code how semantic-ui-dropdown module does the transformation: https://github.com/Semantic-Org/Semantic-UI/blob/master/src/definitions/modules/dropdown.js#L358

The same dropdown with jQuery example works successfully if a div element is used instead, e.g.:

val el = <div class="ui selection dropdown">
  <input type="hidden" name="gender"/>
  <i class="dropdown icon"></i>
  <div class="default text">Gender</div>
  <div class="menu">
    <div class="item" data-value="1">Male</div>
    <div class="item" data-value="0">Female</div>
  </div>
</div>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions