class Canon::Diff::DiffClassifier
def inside_whitespace_sensitive_element?(diff_node)
-
(Boolean)- true if whitespace is preserved for this element
Parameters:
-
diff_node(DiffNode) -- The diff node to check
def inside_whitespace_sensitive_element?(diff_node) node = diff_node.node1 || diff_node.node2 return false unless node # HTML: whitespace between inline element siblings is significant if Canon::Comparison::WhitespaceSensitivity.inline_whitespace_significant?(node) return true end # HTML: non-breaking space (U+00A0) is never insignificant text = Canon::Comparison::NodeInspector.text_content(node) if text && Canon::Comparison::WhitespaceSensitivity.contains_nbsp?(text) return true end return false unless Canon::XmlParsing.element?(node) || node.is_a?(Canon::Xml::Node) parent = node.parent return false unless parent match_opts = @match_options.options Canon::Comparison::WhitespaceSensitivity.whitespace_preserved?(parent, match_opts) end