Advertisement
Guest User

Untitled

a guest
Jun 28th, 2011
264
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.         // "True if among editable Text nodes that are effectively contained in
  2.         // the active range, there are two that have distinct effective values.
  3.         // Otherwise false."
  4.         return collectAllEffectivelyContainedNodes(getActiveRange(), function(node) {
  5.             return isEditable(node) && node.nodeType == Node.TEXT_NODE;
  6.         }).map(function(node) {
  7.             return getEffectiveValue(node, "fontname");
  8.         }).filter(function(value, i, arr) {
  9.             return arr.slice(0, i).indexOf(value) == -1;
  10.         }).length >= 2;
  11.  
  12.         // vs.
  13.         var nodes = collectAllEffectivelyContainedNodes(getActiveRange(), function(node) {
  14.             return isEditable(node) && node.nodeType == Node.TEXT_NODE;
  15.         });
  16.         if (!nodes.length) {
  17.             return false;
  18.         }
  19.         var value = getEffectiveValue(nodes[0], "fontname");
  20.         for (var i = 1; i < nodes.length; i++) {
  21.             if (getEffectiveValue(nodes[i], "fontname") != value) {
  22.                 return true;
  23.             }
  24.         }
  25.         return false;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement