Hi Alex,

maybe you said ";" and you want to say "/", I think the algorithm should
break in:

parts[0] -> color: #666
parts[1] -> height: 176px
parts[2] -> background: url('assets/Unknown.jpeg') center / cover

and then when reach the latest, split in:

pieces = ["background", "url('assets/Unknown.jpeg') center / cover"]

isn't it?

Anyway, if I try to reduce to this:

<mdl:CardTitle style="color: #666;height: 176px;
background:url('assets/Unknown.jpeg')">

I continue having the same null error.







2016-11-09 19:14 GMT+01:00 Alex Harui <aha...@adobe.com>:

> Hi Carlos,
>
> I'm wondering if you get an error without your code in there.  It might be
> that the trailing ';' in the string creates a problem for the algorithm.
> It might split the parts into 4 parts where the last part is essentially
> an empty string and thus there is no ':' and so pieces[1] will be null.
> Then values would be null.  I don't like adding checks for stuff like
> that, but maybe we have to for now.
>
> -Alex
>
> On 11/9/16, 9:48 AM, "carlos.rov...@gmail.com on behalf of Carlos Rovira"
> <carlos.rov...@gmail.com on behalf of carlos.rov...@codeoscopic.com>
> wrote:
>
> >I want that having this line:
> >
> ><mdl:CardTitle style="color: #666;height: 176px; *background:
> >url('assets/Unknown.jpeg') center / cover;*">
> >
> >avoid background property removal.
> >
> >So in this method I added the bold lines:
> >
> >public function parseStyles(styles:String):Object
> >        {
> >            var obj:Object = {};
> >            var parts:Array = styles.split(";");
> >            for each (var part:String in parts)
> >            {
> >                var pieces:Array = part.split(":");
> >                var value:String = pieces[1];
> >                if (value == "null")
> >                    obj[pieces[0]] = null;
> >                else if (value == "true")
> >                    obj[pieces[0]] = true;
> >                else if (value == "false")
> >                    obj[pieces[0]] = false;
> >                *else if(value.indexOf("url") >= 0)*
> >*                    obj[pieces[0]] = value;*
> >                else
> >                {
> >                    var n:Number = Number(value);
> >                    if (isNaN(n))
> >                    {
> >                        if (value.charAt(0) == "#")
> >                        {
> >                            obj[pieces[0]] = CSSUtils.toColor(value);
> >                        }
> >                        else
> >                        {
> >                            if (value.charAt(0) == "'")
> >                                value = value.substr(1, value.length - 2);
> >                            else if (value.charAt(0) == '"')
> >                                value = value.substr(1, value.length - 2);
> >                            obj[pieces[0]] = value;
> >                        }
> >                    }
> >                    else
> >                        obj[pieces[0]] = n;
> >                }
> >            }
> >            return obj;
> >        }
> >
> >
> >
> >
> >2016-11-09 18:43 GMT+01:00 Alex Harui <aha...@adobe.com>:
> >
> >>
> >>
> >> On 11/9/16, 9:22 AM, "carlos.rov...@gmail.com on behalf of Carlos
> >>Rovira"
> >> <carlos.rov...@gmail.com on behalf of carlos.rov...@codeoscopic.com>
> >> wrote:
> >>
> >> >Hi Alex,
> >> >
> >> >I'm trying to do this simple String operation:
> >> >
> >> >if(value.indexOf("url") >= 0)
> >> >       obj[pieces[0]] = pieces[1];
> >> >
> >> >and browser is reporting this error:
> >> >
> >> >"TypeError: null is not an object (evaluating 'value.indexOf')"
> >> >
> >> >maybe is something simple I can't see, but I can't see the problem
> >>here...
> >> >
> >> >Hope you could give some clue
> >>
> >> Is this inside parseStyles?  What is the input string?  Maybe post all
> >>of
> >> parseStyles so we can see it in context.
> >>
> >> -Alex
> >>
> >>
> >
> >
> >--
> >
> >Carlos Rovira
> >Director General
> >M: +34 607 22 60 05
> >http://www.codeoscopic.com
> >http://www.avant2.es
> >
> >
> >Este mensaje se dirige exclusivamente a su destinatario y puede contener
> >información privilegiada o confidencial. Si ha recibido este mensaje por
> >error, le rogamos que nos lo comunique inmediatamente por esta misma vía y
> >proceda a su destrucción.
> >
> >De la vigente Ley Orgánica de Protección de Datos (15/1999), le
> >comunicamos
> >que sus datos forman parte de un fichero cuyo responsable es CODEOSCOPIC
> >S.A. La finalidad de dicho tratamiento es facilitar la prestación del
> >servicio o información solicitados, teniendo usted derecho de acceso,
> >rectificación, cancelación y oposición de sus datos dirigiéndose a
> >nuestras
> >oficinas c/ Paseo de la Habana 9-11, 28036, Madrid con la documentación
> >necesaria.
>
>


-- 

Carlos Rovira
Director General
M: +34 607 22 60 05
http://www.codeoscopic.com
http://www.avant2.es


Este mensaje se dirige exclusivamente a su destinatario y puede contener
información privilegiada o confidencial. Si ha recibido este mensaje por
error, le rogamos que nos lo comunique inmediatamente por esta misma vía y
proceda a su destrucción.

De la vigente Ley Orgánica de Protección de Datos (15/1999), le comunicamos
que sus datos forman parte de un fichero cuyo responsable es CODEOSCOPIC
S.A. La finalidad de dicho tratamiento es facilitar la prestación del
servicio o información solicitados, teniendo usted derecho de acceso,
rectificación, cancelación y oposición de sus datos dirigiéndose a nuestras
oficinas c/ Paseo de la Habana 9-11, 28036, Madrid con la documentación
necesaria.

Reply via email to