Skip to content

Commit c5d68cf

Browse files
committed
Sync with Kendo UI Professional
1 parent d0a4a6c commit c5d68cf

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+203
-155
lines changed

src/colorpicker/colorgradient.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -584,6 +584,7 @@ import "../kendo.icons.js";
584584
}
585585

586586
newSvg = $(contrastToolUtils.renderSvgCurveLine(metrics, that._getHSV(), backgroundColor)).addClass(svgClassName);
587+
kendo.applyStylesFromKendoAttributes(newSvg, ["position", "overflow", "pointer-events", "left", "top", "z-index"]);
587588

588589
hsvRect.find("." + svgClassName).remove();
589590
hsvRect.append(newSvg);

src/colorpicker/colorpalette.js

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ import "../kendo.core.js";
209209
}
210210

211211
cellElements +=
212-
`<td role="gridcell" unselectable="on" style="background-color:${colors[i].toCss()}"` +
212+
`<td role="gridcell" unselectable="on" ${kendo.attr("style-background-color")}="${colors[i].toCss()}"` +
213213
`${selected ? " aria-selected=true" : ""} ` +
214214
`${(id && i === 0) ? 'id=\\"' + id + '\\" ' : '' } ` +
215215

@@ -262,23 +262,27 @@ import "../kendo.core.js";
262262
_wrapper: function() {
263263
var options = this.options,
264264
colors = this._colors(),
265-
wrapper;
265+
wrapper,
266+
templateElement;
266267

267268
if (this.element.is("input")) {
268269
wrapper = this.element.addClass("k-hidden").wrap("<div>").parent();
269270
} else {
270271
wrapper = this.element;
271272
}
272273

274+
templateElement = $(this._template({
275+
colors: colors,
276+
columns: options.columns,
277+
tileSize: options.tileSize,
278+
value: this._value,
279+
id: options.ariaId
280+
}));
281+
282+
kendo.applyStylesFromKendoAttributes(templateElement, ["background-color"]);
273283
wrapper.addClass("k-colorpalette")
274284
.attr("role", "grid")
275-
.append($(this._template({
276-
colors: colors,
277-
columns: options.columns,
278-
tileSize: options.tileSize,
279-
value: this._value,
280-
id: options.ariaId
281-
})))
285+
.append(templateElement)
282286
.attr("tabindex", this._tabIndex);
283287

284288
this.wrapper = wrapper;

src/colorpicker/contrastToolUtils.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,8 @@ import "../kendo.core.js";
107107
svgPath(getPaths(AAA_CONTRAST, STEP_COUNT, false), bezierCommandCalc) +
108108
svgPath(getPaths(AAA_CONTRAST, STEP_COUNT, true), bezierCommandCalc);
109109

110-
return '<svg xmlns="http://www.w3.org/2000/svg" style="position: absolute; overflow: visible; pointer-events: none; left: 0px; top: 0px; z-index: 3;" >' +
110+
return `<svg xmlns="http://www.w3.org/2000/svg" ${kendo.attr("style-position")}="absolute" ${kendo.attr("style-overflow")}="visible" ${kendo.attr("style-pointer-events")}="none" ` +
111+
`${kendo.attr("style-left")}="0px" ${kendo.attr("style-top")}="0px" ${kendo.attr("style-z-index")}="3" >` +
111112
paths + '</svg>';
112113
}
113114

src/kendo.core.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5248,6 +5248,20 @@ function pad(number, digits, end) {
52485248
//kendo.registerCssClasses("align", alignValues);
52495249
kendo.registerCssClasses("positionMode", positionModeValues);
52505250

5251+
kendo.applyStylesFromKendoAttributes = function(element, styleProps) {
5252+
let selector = styleProps.map(styleProp=> `[${kendo.attr(`style-${styleProp}`)}]`).join(',');
5253+
element.find(selector).addBack(selector).each((_, currentElement) => {
5254+
let $currentElement = $(currentElement);
5255+
styleProps.forEach(function(styleProp) {
5256+
let kendoAttr = kendo.attr(`style-${styleProp}`);
5257+
if ($currentElement.attr(kendoAttr)) {
5258+
$currentElement.css(styleProp, $currentElement.attr(kendoAttr));
5259+
$currentElement.removeAttr(kendoAttr);
5260+
}
5261+
});
5262+
});
5263+
};
5264+
52515265
// jQuery deferred helpers
52525266

52535267
// influenced from: https://gist.github.com/fearphage/4341799

src/kendo.list.js

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ var __meta__ = {
7676

7777
UL_EL = '<ul unselectable="on"/>',
7878
LIST_EL = "<div class='k-list'/>",
79-
NO_DATA_EL = '<div class="k-no-data" style="display: none;"></div>',
79+
NO_DATA_EL = '<div class="k-no-data"></div>',
8080
LIST_FOOTER_EL = '<div class="k-list-footer"></div>',
8181
TABLE_FOOTER_EL = '<div class="k-table-footer">' +
8282
'<span class="k-table-td"></span>' +
@@ -311,6 +311,7 @@ var __meta__ = {
311311

312312
_columnsHeader: function() {
313313
var list = this;
314+
var $header;
314315
var columnsHeader = $(list.columnsHeader);
315316

316317
this._angularElement(columnsHeader, "cleanup");
@@ -332,10 +333,7 @@ var __meta__ = {
332333
var widthStyle = '';
333334

334335
if (currentWidth && !isNaN(currentWidthInt)) {
335-
widthStyle += "style='width:";
336-
widthStyle += currentWidthInt;
337-
widthStyle += percentageUnitsRegex.test(currentWidth) ? "%" : "px";
338-
widthStyle += ";'";
336+
widthStyle += `${kendo.attr('style-width')}="${currentWidthInt}${percentageUnitsRegex.test(currentWidth) ? "%" : "px"}"`;
339337
}
340338

341339
colGroup += "<col " + widthStyle + "/>";
@@ -344,14 +342,18 @@ var __meta__ = {
344342
row += columnsHeaderTemplate(currentColumn);
345343
row += "</th>";
346344
}
345+
347346
colGroup += "</colgroup>";
348347
row += "</tr>";
349348
header += colGroup;
350349
header += "<thead class='k-table-thead'>";
351350
header += row;
352351
header += "</thead></table></div></div>";
353352

354-
list.columnsHeader = columnsHeader = $(header);
353+
$header = $(header);
354+
kendo.applyStylesFromKendoAttributes($header, ["width"]);
355+
356+
list.columnsHeader = columnsHeader = $header;
355357
list.list.prepend(columnsHeader);
356358

357359
this._angularElement(list.columnsHeader, "compile");
@@ -371,7 +373,7 @@ var __meta__ = {
371373
return;
372374
}
373375

374-
list.noData = $(NO_DATA_EL).appendTo(list.list);
376+
list.noData = $(NO_DATA_EL).hide().appendTo(list.list);
375377
list.noDataTemplate = typeof template !== "function" ? kendo.template(template) : template;
376378
},
377379

@@ -2147,7 +2149,7 @@ var __meta__ = {
21472149
this.element.addClass(TABLE_LIST);
21482150
} else {
21492151
this.content = this.element.wrap("<div class='k-list-content k-list-scroller' unselectable='on'></div>").parent();
2150-
this.header = this.content.before('<div class="k-list-group-sticky-header" style="display:none"></div>').prev();
2152+
this.header = this.content.before($('<div class="k-list-group-sticky-header"></div>').hide()).prev();
21512153
this.element.addClass(LIST_UL);
21522154
}
21532155

@@ -2941,11 +2943,9 @@ var __meta__ = {
29412943
var widthStyle = '';
29422944

29432945
if (currentWidth && !isNaN(currentWidthInt)) {
2944-
widthStyle += "style='width:";
2945-
widthStyle += currentWidthInt;
2946-
widthStyle += percentageUnitsRegex.test(currentWidth) ? "%" : "px";
2947-
widthStyle += ";'";
2946+
widthStyle += `${kendo.attr('style-width')}="${currentWidthInt}${percentageUnitsRegex.test(currentWidth) ? "%" : "px"}"`;
29482947
}
2948+
29492949
item += "<span class='k-table-td' " + widthStyle + ">";
29502950
item += this.templates["column" + i](dataItem);
29512951
item += "</span>";
@@ -2956,7 +2956,7 @@ var __meta__ = {
29562956

29572957
_render: function() {
29582958
var html = "";
2959-
2959+
var cspCompliantHtml;
29602960
var i = 0;
29612961
var idx = 0;
29622962
var context;
@@ -2999,7 +2999,10 @@ var __meta__ = {
29992999

30003000
this._view = dataContext;
30013001

3002-
this.element[0].innerHTML = html;
3002+
cspCompliantHtml = $(html);
3003+
kendo.applyStylesFromKendoAttributes(cspCompliantHtml, ["width", "background-color"]);
3004+
3005+
this.element.empty().append(cspCompliantHtml);
30033006

30043007
if (isGrouped && dataContext.length) {
30053008
this._renderHeader();

src/kendo.menu.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ var __meta__ = {
184184
},
185185

186186
groupAttributes: function(group) {
187-
return group.expanded !== true ? " style='display:none'" : "";
187+
return group.expanded !== true ? `${kendo.attr("style-display")}="none"` : "";
188188
},
189189

190190
groupCssClass: function() {
@@ -920,17 +920,21 @@ var __meta__ = {
920920

921921
if (referenceItem && !parent.length) {
922922
parent = $(that.renderGroup({ group: groupData, options: that.options })).css("display", "none").appendTo(referenceItem);
923+
kendo.applyStylesFromKendoAttributes(parent, ["display"]);
923924
}
924925

925926
if (plain || isArray(item) || item instanceof kendo.data.ObservableArray) { // is JSON
926927
items = $($.map(plain ? [ item ] : item, function(value, idx) {
927928
if (typeof value === "string") {
928929
return $(value).get();
929930
} else {
930-
return $(that.renderItem({
931+
let itemElement = $(that.renderItem({
931932
group: groupData,
932933
item: extend(value, { index: idx })
933-
})).get();
934+
}));
935+
936+
kendo.applyStylesFromKendoAttributes(itemElement, ["display"]);
937+
return itemElement.get();
934938
}
935939
}));
936940
} else {

src/kendo.multiselect.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1394,6 +1394,8 @@ var __meta__ = {
13941394

13951395
that._setOption(getter(addedItem.dataItem), true);
13961396
}
1397+
1398+
kendo.applyStylesFromKendoAttributes(that.tagList, ["background-color"]);
13971399
} else {
13981400
if (!that._maxTotal || that._maxTotal < total) {
13991401
that._maxTotal = total;
@@ -1439,6 +1441,8 @@ var __meta__ = {
14391441
maxTotal: that._maxTotal,
14401442
currentTotal: total
14411443
}));
1444+
1445+
kendo.applyStylesFromKendoAttributes(that.tagList, ["background-color"]);
14421446
}
14431447

14441448
that._refreshTagListAria();

src/kendo.panelbar.js

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ var __meta__ = {
144144
return item.encoded === false ? item.text : kendo.htmlEncode(item.text);
145145
},
146146
groupAttributes: function(group) {
147-
return group.expanded !== true ? " style='display:none'" : "";
147+
return group.expanded !== true ? ` ${kendo.attr("style-display")}="none"` : "";
148148
},
149149
ariaHidden: function(group) {
150150
return group.expanded !== true;
@@ -153,7 +153,7 @@ var __meta__ = {
153153
return "k-panelbar-group k-group k-panel";
154154
},
155155
contentAttributes: function(content) {
156-
return content.item.expanded !== true ? " style='display:none'" : "";
156+
return content.item.expanded !== true ? ` ${kendo.attr("style-display")}="none"` : "";
157157
},
158158
content: function(item) {
159159
return item.content ? item.content : item.contentUrl ? "" : "&nbsp;";
@@ -611,10 +611,13 @@ var __meta__ = {
611611
return $(value);
612612
} else {
613613
value.items = [];
614-
return $(that.renderItem({
614+
let itemElement = $(that.renderItem({
615615
group: groupData,
616616
item: extend(value, { index: idx })
617617
}));
618+
619+
kendo.applyStylesFromKendoAttributes(itemElement, ["display"]);
620+
return itemElement;
618621
}
619622
});
620623

@@ -846,10 +849,13 @@ var __meta__ = {
846849
if (typeof value === "string") {
847850
return $(value);
848851
} else {
849-
return $(that.renderItem({
852+
let itemElement = $(that.renderItem({
850853
group: groupData,
851854
item: extend(value, { index: idx })
852855
}));
856+
857+
kendo.applyStylesFromKendoAttributes(itemElement, ["display"]);
858+
return itemElement;
853859
}
854860
});
855861

@@ -1232,7 +1238,9 @@ var __meta__ = {
12321238
};
12331239

12341240
if (isReferenceItem && !parent.length) {
1235-
parent = $(that.renderGroup({ group: groupData, options: that.options })).appendTo(referenceItem);
1241+
parent = $(that.renderGroup({ group: groupData, options: that.options }));
1242+
kendo.applyStylesFromKendoAttributes(parent, ["display"]);
1243+
parent.appendTo(referenceItem);
12361244
}
12371245

12381246
if (plain || Array.isArray(item) || item instanceof HierarchicalDataSource) { // is JSON or HierarchicalDataSource
@@ -1244,10 +1252,13 @@ var __meta__ = {
12441252
if (typeof value === "string") {
12451253
return $(value);
12461254
} else {
1247-
return $(that.renderItem({
1255+
let itemElement = $(that.renderItem({
12481256
group: groupData,
12491257
item: extend(value, { index: idx })
12501258
}));
1259+
1260+
kendo.applyStylesFromKendoAttributes(itemElement, ["display"]);
1261+
return itemElement;
12511262
}
12521263
});
12531264
if (isReferenceItem) {
@@ -1588,7 +1599,7 @@ var __meta__ = {
15881599
},
15891600

15901601
_addGroupElement: function(element) {
1591-
var group = $('<ul role="group" aria-hidden="true" class="k-panelbar-group k-group k-panel" style="display:none"></ul>');
1602+
var group = $('<ul role="group" aria-hidden="true" class="k-panelbar-group k-group k-panel"></ul>').hide();
15921603

15931604
element.append(group);
15941605
return group;

src/kendo.tabstrip.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ var __meta__ = {
110110
return item.url ? "a" : "span";
111111
},
112112
contentAttributes: function(content) {
113-
return content.active !== true ? " style='display:none' aria-hidden='true'" : "";
113+
return content.active !== true ? ` ${kendo.attr("style-display")}="none" aria-hidden='true'` : "";
114114
},
115115
content: function(item) {
116116
return item.content ? item.content : item.contentUrl ? "" : "&nbsp;";
@@ -1031,9 +1031,12 @@ var __meta__ = {
10311031

10321032
contents = map( tab, function(value, idx) {
10331033
if (typeof value.content == "string" || value.contentUrl) {
1034-
return $(TabStrip.renderContent({
1034+
let tabstripContent = $(TabStrip.renderContent({
10351035
item: extend(value, { index: idx })
10361036
}));
1037+
1038+
kendo.applyStylesFromKendoAttributes(tabstripContent, ["display"]);
1039+
return tabstripContent;
10371040
}
10381041
});
10391042
} else {

src/kendo.virtuallist.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,10 @@ var __meta__ = {
182182
} else {
183183
element.removeClass("k-table-alt-row");
184184
}
185-
element.html(renderColumns(this.options, data.item, templates));
185+
186+
let renderedColumns = $(renderColumns(this.options, data.item, templates));
187+
kendo.applyStylesFromKendoAttributes(renderedColumns, ["width", "max-width"]);
188+
element.empty().append(renderedColumns);
186189
} else {
187190
element.find("." + GROUPITEM).remove();
188191
element.find(".k-list-item-text").html(itemTemplate(data.item || {}));
@@ -226,7 +229,7 @@ var __meta__ = {
226229

227230
if (currentWidth) {
228231
let widthValue = `${currentWidthInt}${percentageUnitsRegex.test(currentWidth) ? "%" : "px"}`;
229-
widthStyle = `style="width: ${widthValue}; max-width: ${widthValue};"`;
232+
widthStyle = `${kendo.attr("style-width")}="${widthValue}" ${kendo.attr("style-max-width")}="${widthValue}"`;
230233
}
231234

232235
item += "<span class='k-table-td' " + widthStyle + ">";

0 commit comments

Comments
 (0)