Giter Site home page Giter Site logo

Comments (5)

marcoscaceres avatar marcoscaceres commented on May 13, 2024

(the double error there is from my own code, which makes multiple calls to toImage()... anyway, hopefully enough there to you to investigate... Ps: ❤️ hyperHTML!)

from hyperhtml.

WebReflection avatar WebReflection commented on May 13, 2024

that's a very interesting issue and while I might be able to somehow fix the error, the logic behind hyperHTML will always trigger network requests for something that might not exist, which is the temporary attribute placeholder.

I didn't know images would use srcset offline too, but I also see that after those errors, everything works as expected and the srcset, once replaced properly, works as usual.

Two possible solutions here:

  1. ignore the error since it's rather a warning but the DOM has no meaning for warnings
  2. create a list of special attributes to replace with dummy attributes, and once parsed the first time, place attributes back again as non dummy.

To be honest I don't like these solutions, and I might place srcset under the section caveats describing that the error can be ignored for real-world results or suggesting work arounds.

const srcset = ["foo.png 200w"];
// use this instead
function withSrcset(srcset, alt) {
  var img = toImage(alt);
  img.srcset = srcset.join(" ");
  return img;
}
function toImage(alt) {
  return hyperHTML.wire()
  `<img
      role="button"
      alt="${alt}"
      width="195" height="80"/>`;
}

from hyperhtml.

WebReflection avatar WebReflection commented on May 13, 2024

on second thoughts, I believe ignoring that error is better than trying to fix it.

Not only Chrome is the only browser bothering about it, it actually forces the browser to ignore it instead of trying to load from the network the placeholder.

I think this might be described as "gotcha" but it'll be a won't fix. What do you think?

from hyperhtml.

WebReflection avatar WebReflection commented on May 13, 2024

FYI https://bugs.chromium.org/p/chromium/issues/detail?id=703588

from hyperhtml.

WebReflection avatar WebReflection commented on May 13, 2024

I've updated the README explaining the issue:
https://github.com/WebReflection/hyperHTML#attributes-resolved-offline-might-show-warnings

I think I'm going to close this as "won't fix" for now, because the issue is a console error but not a real bug for hyperHTML and the solution is basically not ideal, since the moment I make those two errors disappear is the moent Chrome will try to download something that will cause networks error each time.

I like Chrome for not triggering the network request, compared to what other browsers do without warning about the "bad attribute content", but I don't like Chrome showing two red errors in console, even if the code didn't break, and Chrome did the right thing discarding an invalid network request upfront.

Apologies if not ideal, but I don't have reasonable workarounds for this. 🤷‍♂️ 🤷‍♀️

from hyperhtml.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.