_hyperscript icon indicating copy to clipboard operation
_hyperscript copied to clipboard

[Bug] show does not seem to work

Open rozek opened this issue 3 years ago • 2 comments

The following code

  <style>
    li > span { display:none }
  </style>

  <script type="text/hyperscript">
    def showElement (Element)
      set *display of Element to 'inline-block'
    end
  
    init
      show #span_with_id
      show .css-class
      show <span[name="element-name"]/>
      
      log 'completed'
    end
  </script>

<body>
If everything works as intended, the following list elements should not be empty:

<br>&nbsp;<br>

<ul>
  <li><span id="span_with_id">this line was found by its HTML id</span></li>
  <li><span class="css-class">this line was found by its CSS class</span></li>
  <li><span name="element-name">this line was found by a CSS query</span></li>
</ul>
</body>

does not show the referenced list elements - however, if you use showElement instead of show, everything works fine (i.e., the references themselves are working)

A live example can be found here

rozek avatar Jul 27 '22 09:07 rozek

Oh... the bug is that show assumes elements start as visible and are hidden by hide. As a workaround, you should be able to specify show #span_with_id with display:inline-block

dz4k avatar Aug 03 '22 10:08 dz4k

Thanks for marking it as a bug

rozek avatar Aug 03 '22 10:08 rozek