Changeset 92972 in webkit
- Timestamp:
- Aug 12, 2011 10:34:12 AM (13 years ago)
- Location:
- trunk/Tools
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/base.js
r92355 r92972 220 220 }; 221 221 222 // Based on http://src.chromium.org/viewvc/chrome/trunk/src/chrome/browser/resources/shared/js/cr/ui.js 223 base.extends = function(base, prototype) 224 { 225 var extended = function() { 226 var element = typeof base == 'string' ? document.createElement(base) : base.call(this); 227 extended.prototype.__proto__ = element.__proto__; 228 element.__proto__ = extended.prototype; 229 element.init && element.init.apply(element, arguments); 230 return element; 231 } 232 233 extended.prototype = prototype; 234 return extended; 235 } 236 222 237 })(); -
trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/base_unittests.js
r92355 r92972 217 217 }); 218 218 219 test("extends", 17, function() { 220 221 var LikeDiv = base.extends("div", { 222 init: function() { 223 this.textContent = "awesome"; 224 }, 225 method: function(msg) { 226 return 42; 227 } 228 }); 229 230 var LikeLikeDiv = base.extends(LikeDiv, { 231 init: function() { 232 this.className = "like"; 233 } 234 }); 235 236 var LikeP = base.extends("p", { 237 init: function(content) { 238 this.textContent = content 239 } 240 }); 241 242 var LikeProgress = base.extends("progress", { 243 init: function() { 244 this.max = 100; 245 this.value = 10; 246 } 247 }); 248 249 var LikeLikeProgress = base.extends(LikeProgress, { 250 completed: function() { 251 this.value = 100; 252 } 253 }); 254 255 document.body.appendChild(new LikeDiv()); 256 equals(document.body.lastChild.tagName, "DIV"); 257 equals(document.body.lastChild.innerHTML, "awesome"); 258 equals(document.body.lastChild.method(), 42); 259 document.body.removeChild(document.body.lastChild); 260 261 document.body.appendChild(new LikeLikeDiv()); 262 equals(document.body.lastChild.tagName, "DIV"); 263 equals(document.body.lastChild.innerHTML, "awesome"); 264 equals(document.body.lastChild.method(), 42); 265 equals(document.body.lastChild.className, "like"); 266 document.body.removeChild(document.body.lastChild); 267 268 document.body.appendChild(new LikeP("super")); 269 equals(document.body.lastChild.tagName, "P"); 270 equals(document.body.lastChild.innerHTML, "super"); 271 raises(function() { 272 document.body.lastChild.method(); 273 }); 274 document.body.removeChild(document.body.lastChild); 275 276 document.body.appendChild(new LikeProgress()); 277 equals(document.body.lastChild.tagName, "PROGRESS"); 278 equals(document.body.lastChild.position, 0.1); 279 equals(document.body.lastChild.innerHTML, ""); 280 raises(function() { 281 document.body.lastChild.method(); 282 }); 283 document.body.removeChild(document.body.lastChild); 284 285 document.body.appendChild(new LikeLikeProgress()); 286 equals(document.body.lastChild.tagName, "PROGRESS"); 287 equals(document.body.lastChild.position, 0.1); 288 document.body.lastChild.completed(); 289 equals(document.body.lastChild.position, 1); 290 document.body.removeChild(document.body.lastChild); 291 }); 292 219 293 })(); -
trunk/Tools/ChangeLog
r92928 r92972 1 2011-08-11 Dimitri Glazkov <dglazkov@chromium.org> 2 3 Add a way to extend DOM objects in garden-o-matic. 4 https://bugs.webkit.org/show_bug.cgi?id=66096 5 6 Reviewed by Adam Barth. 7 8 * BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/base.js: Added base.extends. 9 * BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/base_unittests.js: Added tests. 10 1 11 2011-08-11 MORITA Hajime <morrita@google.com> 2 12
Note: See TracChangeset
for help on using the changeset viewer.