Loading ...
Sorry, an error occurred while loading the content.

Optimization for Numerous Bugs

Expand Messages
  • stein.dave@ymail.com
    Hey Dav, In a short time I was able to find a couple more bugs (at least in FF 3.5 where I m playin in). If you highlight an area with font changed already and
    Message 1 of 4 , Jul 23, 2009
    • 0 Attachment
      Hey Dav,

      In a short time I was able to find a couple more bugs (at least in FF 3.5 where I'm playin in). If you highlight an area with font changed already and decide to change the font, the selected node will change to all highlighted text before the already-changed span. I was also randomly playing with colors, fonts, and underlining until I suddenly couldn't remove the underlining. I've written about 300 lines to "correctly" determine the selection and wrap a span around it. It's still a bit buggy (too many spans will confuse it and did not put in the ifs for LIs yet) The gist is to use startContainer, endContainer, and commonAncestorContainer to place all highlighted text into a new span. The real trick is accounting for half highlighted textnodes. It involves quite a bit of node traversal and node cloning but still runs quite fast. However since it saves the wrapped span in the end, it avoids plenty of problems, gets rid of that Times New Roman text flicker, and makes it easy(ier?) to add actual CSS classes within the RTE. I might just be crazy, but maybe you want to take a look? I also have a 40 line function to wipe out any spans that are no longer needed and whatnot.



      Dave
    • Dav Glass
      Create a bug in the Bug Tracker and attach it. http://yuilibrary.com/projects/yui2/newticket?verison=2.7.0&component=Editor&type=enhancement Or fork the
      Message 2 of 4 , Jul 23, 2009
      • 0 Attachment
        Create a bug in the Bug Tracker and attach it.
        http://yuilibrary.com/projects/yui2/newticket?verison=2.7.0&component=Editor&type=enhancement

        Or fork the project on GitHub and make the changes there..

        The only real issue with this approach is this.

        Start with this HTML:

        <p>This is a test.</p><ul><li>This is another test.</li></ul>

        Now select from the first "is" to the second "is". What happens?

        Does it look like this:

        <p>This <span>is a test.</p><ul><li>This is</span> another test.</li></ul>

        or this (the correct way):

        <p>This <span>is a test.</span></p><ul><li><span>This is</span> another test.</li></ul>

        Dav

        On Thu, 23 Jul 2009, stein.dave@... wrote:

        > Hey Dav,
        >
        > In a short time I was able to find a couple more bugs (at least in FF 3.5 where I'm playin in). If you highlight an area with font changed already and decide to change the font, the selected node will change to all highlighted text before the already-changed span. I was also randomly playing with colors, fonts, and underlining until I suddenly couldn't remove the underlining. I've written about 300 lines to "correctly" determine the selection and wrap a span around it. It's still a bit buggy (too many spans will confuse it and did not put in the ifs for LIs yet) The gist is to use startContainer, endContainer, and commonAncestorContainer to place all highlighted text into a new span. The real trick is accounting for half highlighted textnodes. It involves quite a bit of node traversal and node cloning but still runs quite fast. However since it saves the wrapped span in the end, it avoids plenty of problems, gets rid of that Times New Roman text flicker, and makes it easy(ier?) to add actual CSS classes with
        > in the RTE. I might just be crazy, but maybe you want to take a look? I also have a 40 line function to wipe out any spans that are no longer needed and whatnot.
        >
        >
        >
        > Dave
        >

        --
        Dav Glass
        davglass@...
        blog.davglass.com


        + Windows: n. - The most successful computer virus, ever. +
        + A computer without a Microsoft operating system is like a dog
        without bricks tied to its head +
        + A Microsoft Certified Systems Engineer is to computing what a
        McDonalds Certified Food Specialist is to fine cuisine +
      • stein.dave@ymail.com
        For LIs, it would kind of just break at the time. I ll be making it the proper way in the future. I did make sure that I still return an array (like
        Message 3 of 4 , Jul 23, 2009
        • 0 Attachment
          For LIs, it would kind of just break at the time. I'll be making it the proper way in the future. I did make sure that I still return an array (like currentElement) even though it's just one right now. I'll definitely submit once I get the LIs fixed up although that is some time away. It's still a work in progress and was wondering if anyone wanted to progress on it with me as long as my method doesn't seem theoretically crazy

          --- In ydn-javascript@yahoogroups.com, Dav Glass <davglass@...> wrote:
          >
          > Create a bug in the Bug Tracker and attach it.
          > http://yuilibrary.com/projects/yui2/newticket?verison=2.7.0&component=Editor&type=enhancement
          >
          > Or fork the project on GitHub and make the changes there..
          >
          > The only real issue with this approach is this.
          >
          > Start with this HTML:
          >
          > <p>This is a test.</p><ul><li>This is another test.</li></ul>
          >
          > Now select from the first "is" to the second "is". What happens?
          >
          > Does it look like this:
          >
          > <p>This <span>is a test.</p><ul><li>This is</span> another test.</li></ul>
          >
          > or this (the correct way):
          >
          > <p>This <span>is a test.</span></p><ul><li><span>This is</span> another test.</li></ul>
          >
          > Dav
          >
          > On Thu, 23 Jul 2009, stein.dave@... wrote:
          >
          > > Hey Dav,
          > >
          > > In a short time I was able to find a couple more bugs (at least in FF 3.5 where I'm playin in). If you highlight an area with font changed already and decide to change the font, the selected node will change to all highlighted text before the already-changed span. I was also randomly playing with colors, fonts, and underlining until I suddenly couldn't remove the underlining. I've written about 300 lines to "correctly" determine the selection and wrap a span around it. It's still a bit buggy (too many spans will confuse it and did not put in the ifs for LIs yet) The gist is to use startContainer, endContainer, and commonAncestorContainer to place all highlighted text into a new span. The real trick is accounting for half highlighted textnodes. It involves quite a bit of node traversal and node cloning but still runs quite fast. However since it saves the wrapped span in the end, it avoids plenty of problems, gets rid of that Times New Roman text flicker, and makes it easy(ier?) to add actual CSS classes with
          > > in the RTE. I might just be crazy, but maybe you want to take a look? I also have a 40 line function to wipe out any spans that are no longer needed and whatnot.
          > >
          > >
          > >
          > > Dave
          > >
          >
          > --
          > Dav Glass
          > davglass@...
          > blog.davglass.com
          >
          >
          > + Windows: n. - The most successful computer virus, ever. +
          > + A computer without a Microsoft operating system is like a dog
          > without bricks tied to its head +
          > + A Microsoft Certified Systems Engineer is to computing what a
          > McDonalds Certified Food Specialist is to fine cuisine +
          >
        • Dav Glass
          I would like to talk about it more, please email me off-list to discuss: davglass@gmail.com Dav ... -- Dav Glass davglass@gmail.com blog.davglass.com +
          Message 4 of 4 , Jul 23, 2009
          • 0 Attachment
            I would like to talk about it more, please email me off-list to discuss:
            davglass@...

            Dav

            On Thu, 23 Jul 2009, stein.dave@... wrote:

            > For LIs, it would kind of just break at the time. I'll be making it the proper way in the future. I did make sure that I still return an array (like currentElement) even though it's just one right now. I'll definitely submit once I get the LIs fixed up although that is some time away. It's still a work in progress and was wondering if anyone wanted to progress on it with me as long as my method doesn't seem theoretically crazy
            >
            > --- In ydn-javascript@yahoogroups.com, Dav Glass <davglass@...> wrote:
            > >
            > > Create a bug in the Bug Tracker and attach it.
            > > http://yuilibrary.com/projects/yui2/newticket?verison=2.7.0&component=Editor&type=enhancement
            > >
            > > Or fork the project on GitHub and make the changes there..
            > >
            > > The only real issue with this approach is this.
            > >
            > > Start with this HTML:
            > >
            > > <p>This is a test.</p><ul><li>This is another test.</li></ul>
            > >
            > > Now select from the first "is" to the second "is". What happens?
            > >
            > > Does it look like this:
            > >
            > > <p>This <span>is a test.</p><ul><li>This is</span> another test.</li></ul>
            > >
            > > or this (the correct way):
            > >
            > > <p>This <span>is a test.</span></p><ul><li><span>This is</span> another test.</li></ul>
            > >
            > > Dav
            > >
            > > On Thu, 23 Jul 2009, stein.dave@... wrote:
            > >
            > > > Hey Dav,
            > > >
            > > > In a short time I was able to find a couple more bugs (at least in FF 3.5 where I'm playin in). If you highlight an area with font changed already and decide to change the font, the selected node will change to all highlighted text before the already-changed span. I was also randomly playing with colors, fonts, and underlining until I suddenly couldn't remove the underlining. I've written about 300 lines to "correctly" determine the selection and wrap a span around it. It's still a bit buggy (too many spans will confuse it and did not put in the ifs for LIs yet) The gist is to use startContainer, endContainer, and commonAncestorContainer to place all highlighted text into a new span. The real trick is accounting for half highlighted textnodes. It involves quite a bit of node traversal and node cloning but still runs quite fast. However since it saves the wrapped span in the end, it avoids plenty of problems, gets rid of that Times New Roman text flicker, and makes it easy(ier?) to add actual CSS classes
            > with
            > > > in the RTE. I might just be crazy, but maybe you want to take a look? I also have a 40 line function to wipe out any spans that are no longer needed and whatnot.
            > > >
            > > >
            > > >
            > > > Dave
            > > >
            > >
            > > --
            > > Dav Glass
            > > davglass@...
            > > blog.davglass.com
            > >
            > >
            > > + Windows: n. - The most successful computer virus, ever. +
            > > + A computer without a Microsoft operating system is like a dog
            > > without bricks tied to its head +
            > > + A Microsoft Certified Systems Engineer is to computing what a
            > > McDonalds Certified Food Specialist is to fine cuisine +
            > >
            >
            >

            --
            Dav Glass
            davglass@...
            blog.davglass.com


            + Windows: n. - The most successful computer virus, ever. +
            + A computer without a Microsoft operating system is like a dog
            without bricks tied to its head +
            + A Microsoft Certified Systems Engineer is to computing what a
            McDonalds Certified Food Specialist is to fine cuisine +
          Your message has been successfully submitted and would be delivered to recipients shortly.