webview: respect properties provided during webview creation

This commit is contained in:
Robo 2016-01-13 22:32:41 +05:30
parent 489539d62e
commit 8b38bbcf18

View file

@ -29,6 +29,7 @@ resolveURL = function(url) {
WebViewAttribute = (function() { WebViewAttribute = (function() {
function WebViewAttribute(name, webViewImpl) { function WebViewAttribute(name, webViewImpl) {
this.name = name; this.name = name;
this.value = webViewImpl.webviewNode[name] || '';
this.webViewImpl = webViewImpl; this.webViewImpl = webViewImpl;
this.ignoreMutation = false; this.ignoreMutation = false;
this.defineProperty(); this.defineProperty();
@ -38,7 +39,7 @@ WebViewAttribute = (function() {
/* Retrieves and returns the attribute's value. */ /* Retrieves and returns the attribute's value. */
WebViewAttribute.prototype.getValue = function() { WebViewAttribute.prototype.getValue = function() {
return this.webViewImpl.webviewNode.getAttribute(this.name) || ''; return this.webViewImpl.webviewNode.getAttribute(this.name) || this.value;
}; };
@ -228,7 +229,7 @@ SrcAttribute = (function(superClass) {
if (this.webViewImpl.webviewNode.hasAttribute(this.name)) { if (this.webViewImpl.webviewNode.hasAttribute(this.name)) {
return resolveURL(this.webViewImpl.webviewNode.getAttribute(this.name)); return resolveURL(this.webViewImpl.webviewNode.getAttribute(this.name));
} else { } else {
return ''; return this.value;
} }
}; };
@ -368,7 +369,7 @@ PreloadAttribute = (function(superClass) {
PreloadAttribute.prototype.getValue = function() { PreloadAttribute.prototype.getValue = function() {
var preload, protocol; var preload, protocol;
if (!this.webViewImpl.webviewNode.hasAttribute(this.name)) { if (!this.webViewImpl.webviewNode.hasAttribute(this.name)) {
return ''; return this.value;
} }
preload = resolveURL(this.webViewImpl.webviewNode.getAttribute(this.name)); preload = resolveURL(this.webViewImpl.webviewNode.getAttribute(this.name));
protocol = preload.substr(0, 5); protocol = preload.substr(0, 5);