Giter Club home page Giter Club logo

Comments (3)

Clive-Ward-Cron avatar Clive-Ward-Cron commented on July 21, 2024

@panlina for my use case wrapping it in a span is working, but I'd like to know if you found an alternative approach of your own.

The way I'm doing it is when I get to a text node that I want to use domtoimage on, I'm creating a span with JS and appending the text node to it. Then I'm appending that span to the text node's original parent. After that I'm passing the span with the text node to domtoimage. I suppose I could undo those DOM changes, but I don't think that its necessary for my use case.

Either way it feels like a lot of extra work to be performed for something that seems like it should work out of the box.

I think the problem might be that the function needs to add the style element to it to preserve any styles applied to the passed node so that the image output actually matches the element on the page.

from dom-to-image-more.

IDisposable avatar IDisposable commented on July 21, 2024

Working on a fix for this now.

from dom-to-image-more.

IDisposable avatar IDisposable commented on July 21, 2024

PR #117 will fix this... but really curious about the use case for this (why would you want an image of some bare text)? Would appreciate a test from @panlina and @Clive-Ward-Cron :)

from dom-to-image-more.

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.