You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rave.apache.org by er...@apache.org on 2013/07/30 17:47:05 UTC
svn commit: r1508501 -
/rave/trunk/rave-portal-resources/src/main/webapp/static/script/core/rave_widget.js
Author: erinnp
Date: Tue Jul 30 15:47:05 2013
New Revision: 1508501
URL: http://svn.apache.org/r1508501
Log:
RAVE-1007: Applying patch from Khazhismel Kumykov with ie8 fix for rave_widgets
Modified:
rave/trunk/rave-portal-resources/src/main/webapp/static/script/core/rave_widget.js
Modified: rave/trunk/rave-portal-resources/src/main/webapp/static/script/core/rave_widget.js
URL: http://svn.apache.org/viewvc/rave/trunk/rave-portal-resources/src/main/webapp/static/script/core/rave_widget.js?rev=1508501&r1=1508500&r2=1508501&view=diff
==============================================================================
--- rave/trunk/rave-portal-resources/src/main/webapp/static/script/core/rave_widget.js (original)
+++ rave/trunk/rave-portal-resources/src/main/webapp/static/script/core/rave_widget.js Tue Jul 30 15:47:05 2013
@@ -57,6 +57,23 @@ define(['underscore', 'core/rave_api', '
}
/**
+ * Workaround for IE8 (HTMLElement is undefined)
+ * An item will have a nodeType of 1 if it is an HTMLElement
+ * Defaults to use instanceof if HTMLElement is defined
+ */
+ isHTMLElement = (function() {
+ if (window.HTMLElement) {
+ return function(item) {
+ return item instanceof HTMLElement;
+ }
+ } else {
+ return function(item) {
+ return item.nodeType && item.nodeType == 1;
+ }
+ }
+ })();
+
+ /**
* Extends the RegionWidget's prototype. Convenience function for adding functionality
* to the RegionWidget interface
* @param mixin {object}
@@ -80,9 +97,12 @@ define(['underscore', 'core/rave_api', '
* @see module:rave_view_manager
*/
Widget.prototype.render = function (el, opts) {
+
+
+
//if we receive only one argument, and the first arg is not a string or dom element, assume it is an opts object
//and el should default to the widgets current render element
- if (!opts && !(_.isString(el) || (el instanceof HTMLElement))) {
+ if (!opts && !(_.isString(el) || (isHTMLElement(el)))) {
opts = el;
el = this._el;
}
@@ -94,7 +114,7 @@ define(['underscore', 'core/rave_api', '
this._view = view;
}
//at this point el must be a valid dom element. if not, throw an error
- if (!(el instanceof HTMLElement)) {
+ if (!(isHTMLElement(el))) {
throw new Error('Cannot render widget. You must provide an el to render the view into');
}
this._el = el;
@@ -220,4 +240,4 @@ define(['underscore', 'core/rave_api', '
return Widget;
- })
\ No newline at end of file
+ })