HTML服务错误动态创建元素

时间:2014-05-11 22:27:57

标签: google-apps-script

我正在使用google-apps-script的html服务,我正在编写一些模块以简化生活。它下面的模块旨在通过易于阅读的符号快速简便地创建元素。

除文本功能外,一切正常。它使用输入函数来创建特定的输入类型。在这种情况下,文本一。当我尝试使用它时,我收到以下错误:

  

不支持来宾构造对象的调用

我无法理解这个错误。有人能解释一下吗?

 var util = {
 create: (function(){

     var element = function (elementName,atributes ){
              var element = $(  document.createElement(elementName)  );
              return atributes ?  element.attr(atributes) : element;
          },

     div = function(atributes){ return element('div',atributes); },
     textArea = function(atributes){ return element('textarea',atributes); },
     input = function(atributes){ return element('input',atributes); },
     text = function(atributes){ 
         atributes.type = "text";
         return input(atributes); 
     };

     return { div:div, input : input, text:text, textArea:textArea}

 })()

 };

0 个答案:

没有答案