1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Console.log trickery

Discussion in 'Programming' started by sarahk, Apr 20, 2022.

  1. #1
    upload_2022-4-21_12-23-45.png

    I wonder what caused this abomination - the summary shows value: true but the detail shows value: false!
    SEMrush
     
    sarahk, Apr 20, 2022 IP
    SEMrush
  2. deathshadow

    deathshadow Acclaimed Member

    Messages:
    9,615
    Likes Received:
    1,964
    Best Answers:
    248
    Trophy Points:
    515
    #2
    Attribute vs. object property. There's a difference. There are certain keywords -- like value -- that can bite you on the backside like that. It can also happen if you end up in quirks mode on legacy UA's, or if you've accidentally mixed namespaces without declaring them.

    You have a possible telltale of that too. "SVG". It's a different namespace from HTML. It's a bug in FF I've TRIED to report multiple times and had deleted for "not being a real problem" and "unable to replicate".

    Could be worse though, could have been labelled "Don't care, wont fix" like the 24 year old "915"
     
    deathshadow, Apr 23, 2022 IP
    sarahk likes this.
  3. sarahk

    sarahk iTamer Staff

    Messages:
    27,844
    Likes Received:
    4,318
    Best Answers:
    122
    Trophy Points:
    665
    #3
    aaah, the value thing makes sense. I'm going to go and mess with that and see if it makes a difference.

    as for SVG, should I change that to "icon", or "img"?
     
    sarahk, Apr 23, 2022 IP
  4. deathshadow

    deathshadow Acclaimed Member

    Messages:
    9,615
    Likes Received:
    1,964
    Best Answers:
    248
    Trophy Points:
    515
    #4
    In the case of SVG it's NOT that it's named SVG as an object property that's the problem. Typically it's the mere PRESENCE of actual SVG image files in the markup that causes the problem. I THINK if you include the NS declaration on the HTML tag it avoids that problem, but I've not tested it.

    Again, why I dislike using SVG files unless I included it from the CSS where it seems to not have these problems... though admittedly when you do it that way you can't do things like animate them from the JS.

    If you have an SVG TAG in your HTML, it can trigger this behavior. The mere PRESENCE OF THE TAG is the problem, not your attribute named SVG.

    Which again is a point of contention between myself and browser makers as they claim this "isn't a real thing that happens" and "SVG has nothing to do with it" even when you show them test cases that exhibit the problem. JUST like how up until quantum Firefox always treated 1rem as 16px regardless of OS or browser setting, or metricless line-heights showing the same behavior in same.

    One of the reasons I'm banned for life from a forum is one of their "staff" SCREAMING "wah wah is not" to that (now defunct) line-height problem, and my daring to call him out on his bullshit.
     
    Last edited: Apr 24, 2022
    deathshadow, Apr 24, 2022 IP
    sarahk likes this.
  5. deathshadow

    deathshadow Acclaimed Member

    Messages:
    9,615
    Likes Received:
    1,964
    Best Answers:
    248
    Trophy Points:
    515
    #5
    I just dug up my notes on this... can't find the example code that showed it broken, but I jotted down in my "reminders" file that setting xmlns:svg thus on the HTML tag:

    <html xmlns:svg="http://www.w3.org/2000/svg">
    Code (markup):
    Prevents the bad behavior of SVG being present breaking the association between attributes and DOM object properties. Only issue is that under a HTML 5 doctype it doesn't validate. ANOTHER of the many reasons I've come to think of HTML 5 validation as being as big a pipedream as CSS validation was in the early 2000's.

    Can't say for certain that's your problem, but the last time I saw said behavior that was one of the things that could trigger it. As I said before being in quirks mode from an invalid doctype, crap (even whitespace) before the doctype, or a handful of other issues. I think having content-bearing markup outside the <body> can also cause it, which is why a lot of cheap hosting "appendages" and just plain invalid tag nesting orders can cause so many headaches.

    Even when HTML 5 says it's ok to violate previous HTML rules like the whole "you can't wrap block level in inline level" they lifted for anchors.
     
    deathshadow, Apr 28, 2022 IP
    sarahk likes this.