Growl generated html

UI Components for JSF
Post Reply
Zardo
Posts: 56
Joined: 29 Jul 2015, 15:41

20 Sep 2021, 14:31

I have a very strange issue with a message drawn on a grawl component.

The problem happens since the migration from myfaces-2.2.7 to mojarra 2.3.9. The generated output is different.

myfaces-2.2.7

Code: Select all

<div id="errorMessagePane_container" class="ui-growl ui-widget" aria-live="polite" style="z-index: 1008;">
   <div class="ui-growl-item-container ui-state-highlight ui-corner-all ui-helper-hidden ui-shadow ui-growl-error" style="display: block;">
      <div role="alert" class="ui-growl-item">
         <div class="ui-growl-icon-close ui-icon ui-icon-closethick" style="display: none;"></div>
         <span class="ui-growl-image ui-growl-image-error"></span>//SPAN OPEN AND CLOSE
		 <span class="ui-growl-severity ui-helper-hidden-accessible">Error</span>
         <div class="ui-growl-message">
            <span class="ui-growl-title">Error title</span>
            <p>Error text</p>
         </div>
         <div style="clear: both;"></div>
				
      </div>
   </div>
</div>
mojarra 2.3.9

Code: Select all

<div id="messages:errorMessagePane_container" class="ui-growl ui-widget" aria-live="polite" style="z-index: 1006;">
   <div class="ui-growl-item-container ui-state-highlight ui-corner-all ui-helper-hidden ui-shadow ui-growl-error" style="display: block;">
      <div role="alert" class="ui-growl-item">
         <div class="ui-growl-icon-close ui-icon ui-icon-closethick" style="display: none;"></div>
         <span class="ui-growl-image ui-growl-image-error">//SPAN OPEN
            <span class="ui-growl-severity ui-helper-hidden-accessible">Error</span>
            <div class="ui-growl-message">
               <span class="ui-growl-title">Error title</span>
               <p>Error text</p>
            </div>
            <div style="clear: both;"></div>
         </span> //SPAN CLOSE
      </div>
   </div>
</div>
In both case I use Primefaces-8.0.

I can't understand the reason. Where should I look in the source code? I can't found the class who renders this html...

Zardo
Posts: 56
Joined: 29 Jul 2015, 15:41

21 Sep 2021, 08:06

Ok, I finally found it. The message are rendered in PrimeFaces.widget.Growl.prototype.renderMessage (check components.js for PF8 and growl.js for PF10).

The problem is that in PF8 the span was an auto-close tag, whereas in PF10 it is closed with an explicit </span> tag

PF8:

Code: Select all

a+='<span class="ui-growl-image ui-growl-image-'+e.severity+'" />'
PF10:

Code: Select all

markup += '<span class="ui-growl-image ui-growl-image-' + msg.severity + '" ></span>';
Overriding the function fixes the problem.

Melloware
Posts: 3717
Joined: 22 Apr 2013, 15:48

22 Sep 2021, 14:16

YEs the upgrade to Jquery 3.5.0 to close a security hole requires that no JQ appended HTML can do things like auto closed tags. So we had to update every place to use open and close tags.

See ticket: https://github.com/primefaces/primefaces/issues/5807
PrimeFaces Developer | PrimeFaces Extensions Developer
GitHub Profile: https://github.com/melloware
PrimeFaces Elite 13.0.0 / PF Extensions 13.0.0
PrimeReact 9.6.1

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 29 guests