IE8上的YUI:参数在dom-style.js上无效 [英] YUI on IE8: Argument not valid on dom-style.js

查看:272
本文介绍了IE8上的YUI:参数在dom-style.js上无效的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我到处都问这个问题,但仍然没有得到任何反馈,让我发疯。我们在使用(Liferay 6.2)的门户网站上使用了一些Alloy UI小部件,并且在IE8的所有浏览器中一切正常。由于某种原因,我得到一个关于setStyle的YUI核心文件函数中的无效参数的错误消息(用于向YUI中的节点添加样式)。我已经意识到IE8对此不满意(这是整个YUI函数):

I have asked this everywhere but still not getting any feedback and is getting me crazy. We are using some Alloy UI widgets on the portal im working with (Liferay 6.2) and everything works fine in all the browsers but IE8. For some reason im getting an error message regarding an invalid argument in one of the YUI core files functions regarding setStyle (what you use to add styles to a node in YUI). I have realized that IE8 is not happy with this (here's the whole YUI function) :

setStyle: function(node, att, val, style) {
    style = style || node.style;
    var CUSTOM_STYLES = Y_DOM.CUSTOM_STYLES;

    if (style) {
        if (val === null || val === '') { // normalize unsetting
            val = '';
        } else if (!isNaN(new Number(val)) && re_unit.test(att)) { // number values may need a unit
            val += Y_DOM.DEFAULT_UNIT;
        }

        if (att in CUSTOM_STYLES) {
            if (CUSTOM_STYLES[att].set) {
                CUSTOM_STYLES[att].set(node, val, style);
                return; // NOTE: return
            } else if (typeof CUSTOM_STYLES[att] === 'string') {
                att = CUSTOM_STYLES[att];
            }
        } else if (att === '') { // unset inline styles
            att = 'cssText';
            val = '';
        }
        style[att] = val;

导致IE8报告错误的原因是这一行:

What is causing IE8 to report the error is this line:

style[att] = val;

显然是因为

val =' '; 

我不明白为什么其他浏览器对该声明没有任何问题只是IE8抱怨它。由于这是 dom-style.js 的一部分,它是Liferay中YUI的核心文件,我真的不想搞砸那些代码。我真的很感激任何帮助,因为我整个星期都处理这个问题,但仍然无法在www上获得关于类似问题的解决方案和/或信息。

What i don't understand is why the other browsers don't have any problem with that declaration and just IE8 complains about it. Since this is part of the dom-style.js which is a core file for YUI in Liferay i really don't want to mess with that code. I will REALLY appreciate any help since i have been dealing with this for the whole week and still can't get a solution and / or information on the www about a similar issue.

推荐答案

好的,这比我想象的更简单。出于某种原因,当您使用以下方法初始化Alloy UI时,所有现代浏览器(包括IE9)都没有任何问题:

Ok this is WAY more simple than i thought. For some reason all the modern browsers (including IE9) don't have any problems when you initialize Alloy UI with :

YUI({ lang: 'ca-ES' }).use(
  'aui-node',
  'aui-datatable',
  'aui-pagination',
  'datatype-date',

function(Y) {...

但IE8 (当然)会给你一系列非常奇怪的控制台错误,如果你不使用YUI的AUI,会让你的小部件工作不好,所以就是我在代码的所有部分用AUI取代了YUI,现在正在工作在IE8中也很好。如果有人可以给出正确的解释将会非常感激,因为我很难理解为什么IE8不能正常使用YUI初始化Alloy UI小部件或使用YUI。

But IE8 (of course) will give you a series of really weird console errors and will make your widgets work bad if you dont use AUI insted of YUI, so that was it i replaced YUI by AUI in all the parts of my code and now is working fine in IE8 too. If somebody can give a proper explanation will be really appreciated since is hard for me to understand why IE8 is not ok with using YUI to initialize Alloy UI widgets or use YUI.

我还在做一些研究,但似乎发生这种情况的原因是因为我在.JS文件上使用YUI,仍然需要找到一个正确的解释。

Im still doing some research on that but it seems that the reason this is happening is because im using YUI on a .JS file, still have to find a proper explanation tho.

这篇关于IE8上的YUI:参数在dom-style.js上无效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆