-
Notifications
You must be signed in to change notification settings - Fork 245
Conversation
…ing BR elements
I agree that some helpers would be nice (that native API is interesting to put it nicely :)). I like the idea of immutable ones as well . Is there no lightweight library doing this though? (Google mostly points me towards React...) |
@robinedman I had a look around before, it doesn't look like there is anything. |
listParentNode.parentNode.insertBefore(listElement, listParentNode.nextElementSibling); | ||
selection.selectMarkers(); | ||
listParentNode.parentNode.removeChild(listParentNode); | ||
if (listParentNode.childNodes.length === 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A comment to say why we do this would be good (because sometimes the paragraph still contains content).
Nice fix! 👍 |
(We’ll wait for the build to finish before merging. See you next year.) |
Some libraries here: http://microjs.com/#dom They generally (maybe always) include things we don't care about though. Possibly if there was one that was good enough, not too weird (thinking of others who want to contribute to Scribe), and that could be custom built with the helpers we want. |
I don't want the monad-like(?) API that libraries such as jQuery provide – On the other hand, I think front-end uses Zepto for their DOM manipulation. Oliver Joseph Ash On 12 June 2014 15:48, Robin Edman [email protected] wrote:
Visit theguardian.com. On your mobile and tablet, download the Guardian This e-mail and all attachments are confidential and may also be Guardian News & Media Limited is a member of Guardian Media Group plc. Registered |
</rte-toolbar> | ||
<rte></rte> | ||
<div class="rte-toolbar"> | ||
<button data-command-name="insertOrderedList">Ol</button> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you mean to change this?
Re. immutable helpers, @domenic thinks there could be performance issues: https://twitter.com/domenic/status/477113074235613184. I’m not sure how we can really measure this. |
The build is still running, but the earliest results demonstrate a small problem in Firefox: https://travis-ci.org/guardian/scribe/jobs/27416128 Note: we didn't have a green build to begin with – there is a known failing test on Firefox 23/24/25. We should get around to solving that (separately from this). |
|
||
if (listElement.nextElementSibling && | ||
listElement.nextElementSibling.textContent === '') { | ||
listElement.nextElementSibling.parentNode.removeChild(listElement.nextElementSibling); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The next sibling will share the same parent, no?
/** | ||
* Chrome: If we apply the insertOrderedList or the insertUnorderedList | ||
* command on an empty block, the OL/UL will be nested inside the block. | ||
* As per: http://jsbin.com/oDOriyU/1/edit?html,js,output |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not your mistake, but I think the isolated case here should be http://jsbin.com/eFiRedUc/1/edit. Or am I going crazy?
/** | ||
* Chrome 27-34: An empty text node is inserted. | ||
*/ | ||
if (listParentNode.childNodes.length === 2 && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We probably don't need to check for childNodes.length === 2
but it does no harm.
This looks good to me! Nice work 😄 |
👍 |
1 similar comment
👍 |
@@ -1,7 +1,8 @@ | |||
{ | |||
"name": "scribe", | |||
"dependencies": { | |||
"lodash-amd": "2.4.1" | |||
"lodash-amd": "2.4.1", | |||
"scribe-common": "0.0.4" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add this entry to the package.json
file as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for pointing that out @TooTallNate. I've added it now.
Fixes oja-list-bug #184
Also changes the amd.html example not to use custom elements, as this caused issues when testing this (NSERROR when doing
insertOrderedList
with the caret at the end of a 1 line paragraph).