Coder Social home page Coder Social logo

Large documents about elm-rte-toolkit HOT 3 OPEN

mweiss avatar mweiss commented on May 30, 2024 3
Large documents

from elm-rte-toolkit.

Comments (3)

alenards avatar alenards commented on May 30, 2024 1

For benchmarking this, would you use a jQuery style selector in DevTools to count up the nodes under the contenteditable section of the element?

from elm-rte-toolkit.

alenards avatar alenards commented on May 30, 2024

I'm working with a variation of the Basic example (from here).

If we consider the basing the child node count of <elm-editor> with a small-ish example like this:

<div contenteditable="true" class="rte-main " data-rte-main="true" data-gramm_editor="false">
    <div data-rte-doc="true">
        <p><i>This is some sample </i><b><i>textlkjlkj</i></b></p>
        <p><b>lkjlkajsdflkdjsaflkjdsalkfjds</b></p>
        <blockquote>
            <p>asdflkdsajfkldsjafkldsjalkfjdsaklfjdslkajfkldsjafkljdsafkljsaldkfjsadfasldfkjsdaf</p>
        </blockquote>
        <p>lkjkjkljasfdsaf</p>
        <ol>
            <li>
                <p>lkjlkjlkj</p>
            </li>
            <li>
                <p>lkjkljklj</p>
            </li>
            <li>
                <p>lkjlkjklj</p>
            </li>
            <li>
                <p>lkjlkjklj</p>
            </li>
        </ol>
    </div>
</div>

For getting the total nodes, we would need to evaluate the nodes at the top-level, and recursively descend each to count their nodes at level, correct?

If so, I think this would be a potential way to count the above:

$("div[data-rte-doc='true']").getElementsByTagName("*").length

When I evaluate that in Console for DevTools on the node <div data-rte-doc="true">, I get 18 as the result (which I'm reasonably sure if the count for the children of <div data-rte-doc="true">).

Or maybe it's easier to just operate from <elm-editor>:

$("elm-editor").getElementsByTagName("*").length
// 21 output

Is this the sort of beginnings of benchmarking that you were considering for this issue?

I assume that having some sample text to load into examples of varying node count would be helpful too.

from elm-rte-toolkit.

alenards avatar alenards commented on May 30, 2024

I just realized that the 2500 nodes might be a Debug.log of the root's children, so toBlockArray and Array.length 🤦

from elm-rte-toolkit.

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.