MyFaces Core
  1. MyFaces Core
  2. MYFACES-3868

Passthrough element ignores passthrough attributes

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.2.1
    • Fix Version/s: None
    • Component/s: JSR-344
    • Labels:
      None

      Description

      In the following example, the passthrough element input has an attribute placeholder, that should be added to the corresponding JSF component as a passthrough attribute:

      <input type="text" jsf:id="name" jsf:value="#

      {bean.name}

      "
      placeholder="Enter name"/>

      With MyFaces 2.2.1 however, the placeholder attribute is not rendered.

      On further inspecting the component, I saw that placeholder is put in the attributes map and not in the passthrough attributes map of the component. That is probably the reason why it is not rendered.

        Activity

        Hide
        Michael Kurz added a comment -
        Show
        Michael Kurz added a comment - I opened the spec issue https://java.net/jira/browse/JAVASERVERFACES_SPEC_PUBLIC-1270 for this.
        Hide
        Leonardo Uribe added a comment -

        Instead copy the attributes in both maps, the fix done was check the case where empty namespace is provided and add the tag attribute that adds it as a passthrough attribute. So, if the attribute is added using p:xxx it will be only added to the passhtrough attribute map and if is added using jsf: it will be added to the component attribute map, like it should be.

        Show
        Leonardo Uribe added a comment - Instead copy the attributes in both maps, the fix done was check the case where empty namespace is provided and add the tag attribute that adds it as a passthrough attribute. So, if the attribute is added using p:xxx it will be only added to the passhtrough attribute map and if is added using jsf: it will be added to the component attribute map, like it should be.
        Hide
        Michael Kurz added a comment -

        Good to hear that there is a simple workaround!

        I will open a spec issue, as I think this should be clarified.

        Show
        Michael Kurz added a comment - Good to hear that there is a simple workaround! I will open a spec issue, as I think this should be clarified.
        Hide
        Leonardo Uribe added a comment -

        I have done some checks and it seems Mojarra since 2.2.0 copy the attribute as a passthrough and as a normal attribute.

        It is clear they are not doing what the spec says. We have no choice but to do the same as Mojarra does ....

        Show
        Leonardo Uribe added a comment - I have done some checks and it seems Mojarra since 2.2.0 copy the attribute as a passthrough and as a normal attribute. It is clear they are not doing what the spec says. We have no choice but to do the same as Mojarra does ....
        Hide
        Michael Kurz added a comment -

        I checked the API doc of TagDecorator:

        https://javaserverfaces.java.net/nonav/docs/2.2/javadocs/javax/faces/view/facelets/TagDecorator.html

        There it is mentioned, that all tag attributes with an empty namespace or a namespace different from the one of the element should be added as attribute to the component. So the MyFaces behavior seems to be correct according to the spec.

        BUT: The text in the API documentation seems to be different from what Mojarra implements as all attributes without a namespace seem to become passthrough attributes in Mojarra (which perfectly makes sense for me and feels like the natural behavior in this case).

        So we probably have to verify if the spec text is correct here.

        Show
        Michael Kurz added a comment - I checked the API doc of TagDecorator: https://javaserverfaces.java.net/nonav/docs/2.2/javadocs/javax/faces/view/facelets/TagDecorator.html There it is mentioned, that all tag attributes with an empty namespace or a namespace different from the one of the element should be added as attribute to the component. So the MyFaces behavior seems to be correct according to the spec. BUT: The text in the API documentation seems to be different from what Mojarra implements as all attributes without a namespace seem to become passthrough attributes in Mojarra (which perfectly makes sense for me and feels like the natural behavior in this case). So we probably have to verify if the spec text is correct here.
        Hide
        Michael Kurz added a comment -

        Added an example that shows the behavior (on the edit page).

        Show
        Michael Kurz added a comment - Added an example that shows the behavior (on the edit page).

          People

          • Assignee:
            Leonardo Uribe
            Reporter:
            Michael Kurz
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development