Giter Club home page Giter Club logo

Comments (2)

rdclark avatar rdclark commented on August 28, 2024

Splitting the parsing from the rendering is an excellent idea, though I've been thinking about a different approach than building a DOM tree: have the parser emit a stream of bytecodes to be read by a simple interpreter to build the attributed string. You could easily store the intermediate form to a file, send it over the wire, etc. Making it a documented format would make it easier to write all kinds of tools to feed data to an iOS app (and having your own simple representation means your code remains simple and memory-efficient.)

This would also simplify your unit testing. You could test the intermediate representation coming out of the parser, then have a few simple tests of the tool that converts the intermediate representation to an attributed string. It makes for a better separation of concerns and easier debugging.

My concern about the DOM tree comes down to memory usage (there are still plenty of 3G phones and 2G iPod Touches out there) and efficiently serializing and deserializing. I don't want to store the actual bytes from an OS X-encoded attributed string as I don't want to bet the two implementations will stay in sync. (Also, it would be nice for folks in Linux and Windows land to have a way to export rich text data in an easily processed format. It would be a major help in my field -- mobile learning tools.)

I'm willing to work on this on a branch if it doesn't conflict with work you're already doing. Kindly let me know.

from dtcoretext.

odrobnik avatar odrobnik commented on August 28, 2024

The existing method works well by having a "fleeting DOM" i.e. have a stack of DTHTMLElements. The stack could be removed and the copying for inheritance could be avoided by using the parent pointer consequently. But for now I am closing this issue because it is not something that can be immediately addressed.

from dtcoretext.

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.