Skip to content

Markup Region's pw-append-id / pw-prepend-id does not work as described #238

@szabeszg

Description

@szabeszg

Short description of the issue

In the blogpost of "ProcessWire 3.0.49" where Markup Regions were introduced, pw-append-id / pw-prepend-id were explained too. According to the "Quick reference" found in the blog post:
Inserting new elements

<div class='pw-append-yo foo'>Appends this div.foo to #yo</div>
<div class='pw-prepend-yo bar'>Prepends this div.bar to #yo</div>

The div tag with all its extra classes and attributes should be inserted into the markup, but this is not the case, only its 'innerHTML" ie. "Appends this div.foo to #yo" is injected, the tag and its attributes are not.

Expected behavior

The tag and its attributes should be added too.
Earlier in that blog post, another example implied that the tag should also be inserted:
<img class='pw-append-sidebar' src='<?=$page->image->url?>'>
This example does not insert anything into the markup, since and image element has no "innerHTML".

Actual behavior

When using pw-append-id / pw-prepend-id, tag and its attributes are not inserted, only the innerHTML (if any).

Steps to reproduce the issue

Test the examples provided in the blog post and check the output in the browser.

Workaround

These ones work:

<x class='pw-prepend-sidebar test-class'><p>A workaround for using class='pw-prepend-sidebar'</p></x>
<x class='pw-append-sidebar'><p>A workaround for using using class='pw-append-sidebar'</p></x>

Additional notes

In the blog post threse are typos:

  • Question mark is missing, it shoult be image->url?>
  • Single/double quote characters are missing from examples (Quick reference section).
  • Since the support for recursive regios have been removed, the blog post should be changed too to indicate this.

Setup/Environment

ProcessWire: 3.0.59
PHP: 5.6.28
Apache: Apache
MySQL: 5.6.34

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions