1&&b(e)}},boxFlex:function(a,
25 | d,c){var b=this,e,f,g,h;if(d.length){e=function(k){var i=k.groups;k=k.keys;var n,r,p,j,l,m,o,y,v,s;r=0;for(p=k.length;rn)M(o.match,b.props.pos,x)}}};f=function(k){var i=0,n,r,p,j,l,m;n=0;for(r=d.length;n';fa(c,"display","box",x);fa(c,"box-align","stretch",u);fa(c,"box-pack","justify",u);R.body.appendChild(c);d=c.firstChild.offsetHeight;
35 | b={boxAlignStretch:function(){return d===100},boxPackJustify:function(){var g=0,h,k;h=0;for(k=c.childNodes.length;h|\+|\~/g, "%").split(/%/g);
859 |
860 | matrix = {
861 | _id : 100,
862 | _class : 10,
863 | _tag : 1
864 | };
865 |
866 | // Start with rule index position
867 | total = 0;
868 |
869 | // Add each selector value to total.
870 | for (i = 0, j = selectorGrid.length; i < j; i++) {
871 | chunk = selectorGrid[i];
872 |
873 | if ((/#/).test(chunk)) {
874 | total += matrix._id;
875 | } else if ((/\.|\[|\:/).test(chunk)) {
876 | total += matrix._class;
877 | } else if ((/[a-zA-Z]+/).test(chunk)) {
878 | total += matrix._tag;
879 | }
880 | }
881 |
882 | return total;
883 | }
884 |
885 | function filterDuplicates (matches, children, type) {
886 | var filteredMatches = [], exists,
887 | spec = (type ? "ordinal" : "flex") + "Specificity",
888 | i, j, x, k, l, f;
889 |
890 | for (i = 0, j = matches.length; i < j; i++) {
891 | x = matches[i];
892 |
893 | if ((!type && x.flex) || (type && x["ordinal-group"])) {
894 | x[spec] = x[spec] || calculateSpecificity(x.selector);
895 |
896 | exists = FALSE;
897 |
898 | for (k = 0, l = filteredMatches.length; k < l; k++) {
899 | f = filteredMatches[k];
900 |
901 | if (f.match === x.match) {
902 | if (f[spec] < x[spec]) {
903 | filteredMatches[j] = x;
904 | }
905 |
906 | exists = TRUE;
907 | return FALSE;
908 | }
909 | }
910 |
911 | if (!exists) {
912 | filteredMatches.push(x);
913 | }
914 | }
915 | }
916 |
917 | return filteredMatches;
918 | }
919 |
920 | function createMatchMatrix(matches, children, type) {
921 | var groups = {}, keys = [], totalRatio = 0,
922 | group, order = "ordinal-group",
923 | BoxOrdinalAttr = "data-" + order,
924 | i, j, kid, k, l, x, key;
925 |
926 | // Filter dupes
927 | matches = filterDuplicates(matches, children, type);
928 |
929 | for (i = 0, j = children.length; i < j; i++) {
930 | kid = children[i];
931 |
932 | for (k = 0, l = matches.length; k < l; k++) {
933 | x = matches[k];
934 |
935 | if (type) {
936 | // If no value declared, it's the default.
937 | group = x[order] || "1";
938 |
939 | if (x.match === kid) {
940 | x.match.setAttribute(BoxOrdinalAttr, group);
941 |
942 | groups[group] = groups[group] || [];
943 | groups[group].push(x);
944 | }
945 | } else {
946 | // If no value declared, it's the default.
947 | group = x.flex || "0";
948 |
949 | if (x.match === kid && (!x[group] || (x[group] && parseInt(x[group], 10) <= 1))) {
950 | totalRatio += parseInt(group, 10);
951 |
952 | groups[group] = groups[group] || [];
953 | groups[group].push(x);
954 | }
955 | }
956 | }
957 |
958 | if (type && !kid.getAttribute(BoxOrdinalAttr)) {
959 | group = "1";
960 | kid.setAttribute(BoxOrdinalAttr, group);
961 |
962 | groups[group] = groups[group] || [];
963 | groups[group].push({
964 | match : kid
965 | });
966 | }
967 | }
968 |
969 | for (key in groups) {
970 | if (groups.hasOwnProperty(key)) {
971 | keys.push(key);
972 | }
973 | }
974 |
975 | keys.sort(function (a, b) {
976 | return b - a;
977 | });
978 |
979 | return {
980 | keys : keys,
981 | groups : groups,
982 | total : totalRatio
983 | };
984 | }
985 |
986 | function attachResizeListener(construct, params) {
987 | if (!RESIZE_LISTENER) {
988 | var storedWidth, storedHeight,
989 | currentWidth, currentHeight,
990 | docBody = doc.body,
991 | docEl = doc.documentElement,
992 | resizeTimer,
993 | innerWidth = "innerWidth", innerHeight = "innerHeight",
994 | clientWidth = "clientWidth", clientHeight = "clientHeight";
995 |
996 | addEvent("resize", function () {
997 | if (resizeTimer) {
998 | window.clearTimeout(resizeTimer);
999 | }
1000 |
1001 | resizeTimer = window.setTimeout(function () {
1002 | currentWidth = win[innerWidth] || docEl[innerWidth] || docEl[clientWidth] || docBody[clientWidth];
1003 | currentHeight = win[innerHeight] || docEl[innerHeight] || docEl[clientHeight] || docBody[clientHeight];
1004 |
1005 | if (storedWidth !== currentWidth || storedHeight !== currentHeight) {
1006 | FLX.updateInstance(NULL, NULL);
1007 |
1008 | storedWidth = currentWidth;
1009 | storedHeight = currentHeight;
1010 | }
1011 | }, 250);
1012 | });
1013 |
1014 | RESIZE_LISTENER = TRUE;
1015 | }
1016 | }
1017 |
1018 | function cleanPositioningProperties (children) {
1019 | var i, j, kid, w, h;
1020 |
1021 | for (i = 0, j = children.length; i < j; i++) {
1022 | kid = children[i];
1023 |
1024 | w = kid.style.width;
1025 | h = kid.style.height;
1026 |
1027 | kid.style.cssText = EMPTY_STRING;
1028 |
1029 | kid.style.width = w;
1030 | kid.style.height = h;
1031 | }
1032 | }
1033 |
1034 | function sanitizeChildren (target, nodes) {
1035 | var children = [], node, i, j;
1036 |
1037 | for (i = 0, j = nodes.length; i < j; i++) {
1038 | node = nodes[i];
1039 |
1040 | if (node) {
1041 | switch (node.nodeName.toLowerCase()) {
1042 | case "script" :
1043 | case "style" :
1044 | case "link" :
1045 | break;
1046 |
1047 | default :
1048 | if (node.nodeType === 1) {
1049 | children.push(node);
1050 | } else if ((node.nodeType === 3) && (node.isElementContentWhitespace || (ONLY_WHITESPACE).test(node.data))) {
1051 | target.removeChild(node);
1052 | i--;
1053 | }
1054 | break;
1055 | }
1056 | }
1057 | }
1058 |
1059 | return children;
1060 | }
1061 |
1062 | function parentFlex (target) {
1063 | var totalFlex = 0,
1064 | parent = target.parentNode,
1065 | obj,
1066 | matrix,
1067 | isNested;
1068 |
1069 | while (parent.FLX_DOM_ID) {
1070 | obj = FLEX_BOXES[parent.FLX_DOM_ID];
1071 | matrix = createMatchMatrix(obj.children, sanitizeChildren(parent, parent.childNodes), NULL);
1072 |
1073 | totalFlex += matrix.total;
1074 | isNested = TRUE;
1075 |
1076 | parent = parent.parentNode;
1077 | }
1078 |
1079 | return {
1080 | nested : isNested,
1081 | flex : totalFlex
1082 | };
1083 | }
1084 |
1085 | function dimensionValues (target, prop) {
1086 | var parent = target.parentNode,
1087 | obj, dimension, i, j, rule;
1088 |
1089 | if (parent.FLX_DOM_ID) {
1090 | obj = FLEX_BOXES[parent.FLX_DOM_ID];
1091 |
1092 | for (i = 0, j = obj.properties.length; i < j; i++) {
1093 | rule = obj.properties[i];
1094 |
1095 | if ((new RegExp(prop)).test(rule.property)) {
1096 | dimension = TRUE;
1097 | return FALSE;
1098 | }
1099 | }
1100 | }
1101 |
1102 | return dimension;
1103 | }
1104 |
1105 | function updateChildValues (params) {
1106 | var i, j, x;
1107 |
1108 | if (params.flexMatrix) {
1109 | for (i = 0, j = params.children.length; i < j; i++) {
1110 | x = params.children[i];
1111 | x.flex = params.flexMatrix[i];
1112 | }
1113 | }
1114 |
1115 | if (params.ordinalMatrix) {
1116 | for (i = 0, j = params.children.length; i < j; i++) {
1117 | x = params.children[i];
1118 | x["ordinal-group"] = params.ordinalMatrix[i];
1119 | }
1120 | }
1121 |
1122 | return params;
1123 | }
1124 |
1125 | function ensureStructuralIntegrity (params, instance) {
1126 | var target = params.target;
1127 |
1128 | if (!target.FLX_DOM_ID) {
1129 | target.FLX_DOM_ID = target.FLX_DOM_ID || (++FLX_DOM_ID);
1130 | }
1131 |
1132 | if (!params.nodes) {
1133 | params.nodes = sanitizeChildren(target, target.childNodes);
1134 | }
1135 |
1136 | if (!params.selector) {
1137 | params.selector = buildSelector(target);
1138 | target.setAttribute(FLX_PARENT_ATTR, TRUE);
1139 | }
1140 |
1141 | if (!params.properties) {
1142 | params.properties = [];
1143 | }
1144 |
1145 | if (!params.children) {
1146 | params.children = matchFlexChildren(target, LIBRARY, sanitizeChildren(target, target.childNodes));
1147 | }
1148 |
1149 | if (!params.nested) {
1150 | params.nested = params.selector + " [" + FLX_PARENT_ATTR + "]";
1151 | }
1152 |
1153 | params.target = target;
1154 | params._instance = instance;
1155 |
1156 | return params;
1157 | }
1158 |
1159 | selectivizrEngine = (function () {
1160 | var RE_COMMENT = /(\/\*[^*]*\*+([^\/][^*]*\*+)*\/)\s*?/g,
1161 | RE_IMPORT = /@import\s*(?:(?:(?:url\(\s*(['"]?)(.*)\1)\s*\))|(?:(['"])(.*)\3))\s*([^;]*);/g,
1162 | RE_ASSET_URL = /(behavior\s*?:\s*)?\burl\(\s*(["']?)(?!data:)([^"')]+)\2\s*\)/g,
1163 | RE_SELECTOR_GROUP = /((?:^|(?:\s*\})+)(?:\s*@media[^\{]+\{)?)\s*([^\{]*?[\[:][^{]+)/g,
1164 |
1165 | // Whitespace normalization regexp's
1166 | RE_TIDY_TRAILING_WHITESPACE = /([(\[+~])\s+/g,
1167 | RE_TIDY_LEADING_WHITESPACE = /\s+([)\]+~])/g,
1168 | RE_TIDY_CONSECUTIVE_WHITESPACE = /\s+/g,
1169 | RE_TIDY_TRIM_WHITESPACE = /^\s*((?:[\S\s]*\S)?)\s*$/;
1170 |
1171 | // --[ trim() ]---------------------------------------------------------
1172 | // removes leading, trailing whitespace from a string
1173 | function trim(text) {
1174 | return text.replace(RE_TIDY_TRIM_WHITESPACE, PLACEHOLDER_STRING);
1175 | }
1176 |
1177 | // --[ normalizeWhitespace() ]------------------------------------------
1178 | // removes leading, trailing and consecutive whitespace from a string
1179 | function normalizeWhitespace(text) {
1180 | return trim(text).replace(RE_TIDY_CONSECUTIVE_WHITESPACE, SPACE_STRING);
1181 | }
1182 |
1183 | // --[ normalizeSelectorWhitespace() ]----------------------------------
1184 | // tidys whitespace around selector brackets and combinators
1185 | function normalizeSelectorWhitespace(selectorText) {
1186 | return normalizeWhitespace(selectorText.replace(RE_TIDY_TRAILING_WHITESPACE, PLACEHOLDER_STRING).replace(RE_TIDY_LEADING_WHITESPACE, PLACEHOLDER_STRING));
1187 | }
1188 |
1189 | // --[ patchStyleSheet() ]----------------------------------------------
1190 | // Scans the passed cssText for selectors that require emulation and
1191 | // creates one or more patches for each matched selector.
1192 | function patchStyleSheet(cssText) {
1193 | return cssText.replace(RE_SELECTOR_GROUP, function (m, prefix, selectorText) {
1194 | var selectorGroups, selector,
1195 | i, j, group;
1196 |
1197 | selectorGroups = selectorText.split(",");
1198 |
1199 | for (i = 0, j = selectorGroups.length; i < j; i++) {
1200 | group = selectorGroups[i];
1201 | selector = normalizeSelectorWhitespace(group) + SPACE_STRING;
1202 | }
1203 |
1204 | return prefix + selectorGroups.join(",");
1205 | });
1206 | }
1207 |
1208 | // --[ getXHRObject() ]-------------------------------------------------
1209 | function getXHRObject() {
1210 | if (win.XMLHttpRequest) {
1211 | return new win.XMLHttpRequest();
1212 | }
1213 |
1214 | try {
1215 | return new win.ActiveXObject("Microsoft.XMLHTTP");
1216 | } catch (e) {
1217 | return NULL;
1218 | }
1219 | }
1220 |
1221 | function parseInlineStyles ( text ) {
1222 | var reg = /