| 100 | | * options - {Object} Optional object for configuring test options. Set |
|---|
| 101 | | * 'prefix' property to true in order to compare element and attribute |
|---|
| 102 | | * prefixes (namespace uri always tested). By default, prefixes |
|---|
| 103 | | * are not tested. |
|---|
| | 100 | * options - {Object} Optional object for configuring test options. |
|---|
| | 101 | * |
|---|
| | 102 | * Valid options: |
|---|
| | 103 | * prefix - {Boolean} Compare element and attribute |
|---|
| | 104 | * prefixes (namespace uri always tested). Default is false. |
|---|
| | 105 | * includeWhiteSpace - {Boolean} Include whitespace only nodes when |
|---|
| | 106 | * comparing child nodes. Default is false. |
|---|
| | 215 | |
|---|
| | 216 | /** |
|---|
| | 217 | * Function getChildNodes |
|---|
| | 218 | * Returns the child nodes of the specified nodes. By default this method |
|---|
| | 219 | * will ignore child text nodes which are made up of whitespace content. |
|---|
| | 220 | * The 'includeWhiteSpace' option is used to control this behaviour. |
|---|
| | 221 | * |
|---|
| | 222 | * Parameters: |
|---|
| | 223 | * node - {DOMElement} |
|---|
| | 224 | * options - {Object} Optional object for test configuration. |
|---|
| | 225 | * |
|---|
| | 226 | * Valid options: |
|---|
| | 227 | * includeWhiteSpace - {Boolean} Include whitespace only nodes when |
|---|
| | 228 | * comparing child nodes. Default is false. |
|---|
| | 229 | * |
|---|
| | 230 | * Returns: |
|---|
| | 231 | * {Array} of {DOMElement} |
|---|
| | 232 | */ |
|---|
| | 233 | function getChildNodes(node, options) { |
|---|
| | 234 | //check whitespace |
|---|
| | 235 | if (options && options.includeWhiteSpace) { |
|---|
| | 236 | return node.childNodes; |
|---|
| | 237 | } |
|---|
| | 238 | else { |
|---|
| | 239 | nodes = []; |
|---|
| | 240 | for (var i = 0; i < node.childNodes.length; i++ ) { |
|---|
| | 241 | var child = node.childNodes[i]; |
|---|
| | 242 | if (child.nodeType == 1) { |
|---|
| | 243 | //element node, add it |
|---|
| | 244 | nodes.push(child); |
|---|
| | 245 | } |
|---|
| | 246 | else if (child.nodeType == 3) { |
|---|
| | 247 | //text node, add if non empty |
|---|
| | 248 | if (child.nodeValue && |
|---|
| | 249 | child.nodeValue.replace(/^\s*(.*?)\s*$/, "$1") != "" ) { |
|---|
| | 250 | |
|---|
| | 251 | nodes.push(child); |
|---|
| | 252 | } |
|---|
| | 253 | } |
|---|
| | 254 | } |
|---|
| | 255 | |
|---|
| | 256 | return nodes; |
|---|
| | 257 | } |
|---|
| | 258 | } |
|---|
| 224 | | * options - {Object} Optional object for configuring test options. Set |
|---|
| 225 | | * 'prefix' property to true in order to compare element and attribute |
|---|
| 226 | | * prefixes (namespace uri always tested). By default, prefixes |
|---|
| 227 | | * are not tested. |
|---|
| | 274 | * options - {Object} Optional object for configuring test. |
|---|
| | 275 | * |
|---|
| | 276 | * Valid options: |
|---|
| | 277 | * prefix - {Boolean} Compare element and attribute |
|---|
| | 278 | * prefixes (namespace uri always tested). Default is false. |
|---|
| | 279 | * includeWhiteSpace - {Boolean} Include whitespace only nodes when |
|---|
| | 280 | * comparing child nodes. Default is false. |
|---|