Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A faster htmlMatcher.js #457

Closed
wants to merge 858 commits into from
Closed

Conversation

eight04
Copy link

@eight04 eight04 commented Jul 12, 2016

I rewrote htmlMatcher.js for better speed on Windows Script Host. But I don't know if it is faster in other environments, also the code is pretty messy. Anyway, here is how it does:

Take this file for example:

<html>
    ... (around 1000 lines) ...
    <ul>
        <li>some list</li>
    </ul>
    .test|
    <a>some link</a>
</html>

The original matcher will scan to top and bottom, match each tags, and return the result [<html>, </html>]. Quick Match 2 will try scanning some tags around the cursor (i.e. </ul>, </li>, <a>, </html>) and "jump" to its pair (text.indexOf). So the matcher will not scan the entire content.

Following steps show the main idea of quick-match-2 (forward search only, backward search is similar):

  1. Find nearest tag -> <a>
  2. Find its pair tag -> </a>
  3. Find nearest tag -> </html>
  4. Find its pair tag -> <html>, the cursor is inside the pair, return the result.

Original discussion

danfooo and others added 30 commits March 13, 2013 16:56
Removed media=all from link:css since it's the de-facto standard, see http://perfectionkills.com/optimizing-html/#1_style_media_all
Свойство "word-wrap: break-word"
Now it can correctly parse attributes with single quotes
Emmet core now works in Dreamweaver
add property to "letter-spacing"
remove the extra properties word-break
add "font-family: "Times New Roman", Times, Baskerville, Georgia, serif;
@sergeche
Copy link
Member

Great job! :) I’m going to do a full rewrite of Emmet soon and I’ll take into account your implementation. Lots of things will change in a new version

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet