File tree Expand file tree Collapse file tree 4 files changed +48
-1
lines changed
Expand file tree Collapse file tree 4 files changed +48
-1
lines changed Original file line number Diff line number Diff line change 1+ ## Prerelese 46 ( TBD )
2+
3+ - [ ] ( ) fix: pfe-tabs check for tagName on addedNode mutation before continuing
4+
15## Prerelese 45 ( 2020-04-27 )
26
37- [ 8dbea7b] ( https://github.com/patternfly/patternfly-elements/commit/8dbea7b5fbd94614d89828c27afafdcc287f016f ) fix: typo in pfe-icon README (#840 )
Original file line number Diff line number Diff line change @@ -406,6 +406,29 @@ <h4>Tab 2</h4>
406406
407407 </ section >
408408
409+ < section class ="example ">
410+ < h2 id ="add-text-to-tab-and-panel "> Dynamically Adding Text to Tab and Panel</ h2 >
411+ < pfe-tabs id ="dynamic-text ">
412+ < pfe-tab role ="heading " slot ="tab " id ="dynamicTextTab "> Tab 1</ pfe-tab >
413+ < pfe-tab-panel role ="region " slot ="panel " id ="dynamicTextPanel ">
414+ < h4 > Tab 1</ h4 >
415+ </ pfe-tab-panel >
416+ </ pfe-tabs >
417+
418+ < div >
419+ < label >
420+ Additional Tab Text
421+ < input type ="text " placeholder ="Additional Tab Text " id ="additional-tab-text ">
422+ </ label >
423+ </ div >
424+ < div >
425+ < label >
426+ Additional Panel Text
427+ < input type ="text " placeholder ="Additional Panel Text " id ="additional-panel-text ">
428+ </ label >
429+ </ div >
430+ </ section >
431+
409432 < script >
410433 var jumpLinksMenu = document . querySelector ( "#jump-links" ) ;
411434 var headings = document . querySelectorAll ( "section > h2[id]" ) ;
@@ -442,6 +465,19 @@ <h4>Tab 2</h4>
442465 fragment . appendChild ( panel ) ;
443466 pfeTabs . appendChild ( fragment ) ;
444467 } ) ;
468+
469+ var dynamicTextTab = document . querySelector ( "#dynamicTextTab" ) ;
470+ var dynamicTextPanel = document . querySelector ( "#dynamicTextPanel" )
471+ var additionalTabTextInput = document . querySelector ( "#additional-tab-text" ) ;
472+ var additionalPanelTextInput = document . querySelector ( "#additional-panel-text" ) ;
473+
474+ additionalTabTextInput . addEventListener ( "change" , function ( event ) {
475+ dynamicTextTab . innerHTML += event . target . value ;
476+ } ) ;
477+
478+ additionalPanelTextInput . addEventListener ( "change" , function ( event ) {
479+ dynamicTextPanel . innerHTML += event . target . value ;
480+ } ) ;
445481 </ script >
446482 </ body >
447483</ html >
Original file line number Diff line number Diff line change @@ -241,6 +241,10 @@ class PfeTabs extends PFElement {
241241 for ( let mutation of mutationsList ) {
242242 if ( mutation . type === "childList" && mutation . addedNodes . length ) {
243243 [ ...mutation . addedNodes ] . forEach ( addedNode => {
244+ if ( ! addedNode . tagName ) {
245+ return ;
246+ }
247+
244248 if (
245249 addedNode . tagName . toLowerCase ( ) === PfeTab . tag ||
246250 addedNode . tagName . toLowerCase ( ) === PfeTabPanel . tag
Original file line number Diff line number Diff line change @@ -99,7 +99,7 @@ <h2>Content 3</h2>
9999
100100 < pfe-tabs id ="dynamic ">
101101 < pfe-tab role ="heading " slot ="tab "> Tab 1</ pfe-tab >
102- < pfe-tab-panel role ="region " slot ="panel "> Tab 1 Content</ pfe-tab-panel >
102+ < pfe-tab-panel role ="region " slot ="panel " id =" dynamicTab1 " > Tab 1 Content</ pfe-tab-panel >
103103 </ pfe-tabs >
104104
105105 < pfe-tabs id ="initialVariant " pfe-variant ="earth ">
@@ -348,6 +348,9 @@ <h1>Tab 2 Content</h1>
348348 documentFragment . appendChild ( newPanel ) ;
349349 pfeAccordion . appendChild ( documentFragment ) ;
350350
351+ const dynamicTab1 = document . querySelector ( "#dynamicTab1" ) ;
352+ dynamicTab1 . innerHTML += "More text" ;
353+
351354 flush ( ( ) => {
352355 const newTabElement = document . querySelector ( "#newTab" ) ;
353356 const newPanelElement = document . querySelector ( "#newPanel" ) ;
You can’t perform that action at this time.
0 commit comments