* Add attributes to the parent element of a text node, * or the element of an attribute node.
( section, element, previousElement, separatorElementAttributes, separatorSectionAttributes )
| 310 | * or the element of an attribute node. |
| 311 | */ |
| 312 | function addAttributes( section, element, previousElement, separatorElementAttributes, separatorSectionAttributes ) { |
| 313 | |
| 314 | if ( element != null && element.childNodes != undefined && element.childNodes.length > 0 ) { |
| 315 | previousParentElement = element; |
| 316 | for( var i = 0; i < element.childNodes.length; i++ ) { |
| 317 | childElement = element.childNodes[i]; |
| 318 | if ( i > 0 ) { |
| 319 | j = i - 1; |
| 320 | while ( j >= 0 ) { |
| 321 | aPreviousChildElement = element.childNodes[j]; |
| 322 | if ( typeof aPreviousChildElement.setAttribute == 'function' && aPreviousChildElement.tagName != "BR" ) { |
| 323 | previousParentElement = aPreviousChildElement; |
| 324 | break; |
| 325 | } |
| 326 | j = j - 1; |
| 327 | } |
| 328 | } |
| 329 | parentSection = section; |
| 330 | if( childElement.nodeName == "section" ) { |
| 331 | parentSection = childElement ; |
| 332 | previousParentElement = childElement ; |
| 333 | } |
| 334 | if ( typeof childElement.setAttribute == 'function' || childElement.nodeType == Node.COMMENT_NODE ) { |
| 335 | addAttributes( parentSection, childElement, previousParentElement, separatorElementAttributes, separatorSectionAttributes ); |
| 336 | } |
| 337 | } |
| 338 | } |
| 339 | |
| 340 | if ( element.nodeType == Node.COMMENT_NODE ) { |
| 341 | if ( addAttributeInElement( element, previousElement, separatorElementAttributes ) == false ) { |
| 342 | addAttributeInElement( element, section, separatorSectionAttributes ); |
| 343 | } |
| 344 | } |
| 345 | } |
| 346 | |
| 347 | /** |
| 348 | * Converts any current data-markdown slides in the |
no test coverage detected