Browse Source

Merge pull request #956 from lucmuller/feature/services-iframe-getelemattr

[FEATURE]Services > Iframe > Use tarteaucitron.getElemAttr instead of elem.getAttribute
Amauri CHAMPEAUX 2 years ago
parent
commit
dd7511ea9c
1 changed files with 7 additions and 7 deletions
  1. 7 7
      tarteaucitron.services.js

+ 7 - 7
tarteaucitron.services.js

@@ -12,11 +12,11 @@ tarteaucitron.services.iframe = {
     "js": function () {
     "js": function () {
         "use strict";
         "use strict";
         tarteaucitron.fallback(['tac_iframe'], function (x) {
         tarteaucitron.fallback(['tac_iframe'], function (x) {
-            var frame_title = (x.getAttribute("title")) ? tarteaucitron.fixSelfXSS(x.getAttribute("title")) : '',
-                width = x.getAttribute("width"),
-                height = x.getAttribute("height"),
-                allowfullscreen = x.getAttribute("allowfullscreen"),
-                url = x.getAttribute("data-url");
+            var frame_title = (tarteaucitron.getElemAttr(x,"title")) ? tarteaucitron.fixSelfXSS(tarteaucitron.getElemAttr(x,"title")) : '',
+                width = tarteaucitron.getElemAttr(x,"width"),
+                height = tarteaucitron.getElemAttr(x,"height"),
+                allowfullscreen = tarteaucitron.getElemAttr(x,"allowfullscreen"),
+                url = tarteaucitron.getElemAttr(x,"url");
 
 
             return '<iframe title="' + frame_title + '" src="' + url + '" width="' + width + '" height="' + height + '" scrolling="no" allowtransparency' + (allowfullscreen == '0' ? '' : ' webkitallowfullscreen mozallowfullscreen allowfullscreen') + '></iframe>';
             return '<iframe title="' + frame_title + '" src="' + url + '" width="' + width + '" height="' + height + '" scrolling="no" allowtransparency' + (allowfullscreen == '0' ? '' : ' webkitallowfullscreen mozallowfullscreen allowfullscreen') + '></iframe>';
         });
         });
@@ -25,8 +25,8 @@ tarteaucitron.services.iframe = {
         "use strict";
         "use strict";
         var id = 'iframe';
         var id = 'iframe';
         tarteaucitron.fallback(['tac_iframe'], function (elem) {
         tarteaucitron.fallback(['tac_iframe'], function (elem) {
-            elem.style.width = elem.getAttribute('width') + 'px';
-            elem.style.height = elem.getAttribute('height') + 'px';
+            elem.style.width = tarteaucitron.getElemAttr(elem,'width') + 'px';
+            elem.style.height = tarteaucitron.getElemAttr(elem,'height') + 'px';
             return tarteaucitron.engage(id);
             return tarteaucitron.engage(id);
         });
         });
     }
     }