* Per Krinkle's comment, be tolerant of missing .htmlAttributes
* Drop .htmlAttributes if no attributes, fixes some tests
Change-Id: I65589a8b489e19a7c8a41ba2f4a57e68fc52684c
* Restricting "camelcase":
No changes, we were passing all of these already
* Explicitly unrestricting "forin" and "plusplus"
These are off by default in node-jshint, but some distro of jshint
and editors that use their own wrapper around jshint instead of
node-jshint (Eclipse?) may have different defaults. Therefor
setting them to false explicitly. This also serves as a reminder
for the future so we'll always know we don't pass that, in case
we would want to change that.
* Fix order ("quotemark" before "regexp")
* Restricting "unused"
We're not passing all of this, which is why I've set it to false
for now. But I did put it in .jshintrc as placeholder.
I've fixed most of them, there's some left where there is no clean
solution.
* While at it fix a few issues:
- Unused variables ($target, $window)
- Bad practices (using jQuery context for find instead of creation)
- Redundant /*global */ comments
- Parameters that are not used and don't have documentation either
- Lines longer than 100 chars @ 4 spaces/tab
* Note:
- ve.ce.Surface.prototype.onChange takes two arguments but never
uses the former. And even the second one can be null/undefined.
Aside from that, the .change() function emits
another event for the transaction already. Looks like this
should be refactored a bit, two more separated events probably
or one that is actually used better.
- Also cleaned up a lot of comments, some of which were missing,
others were incorrect
- Reworked the contentChange event so we are no longer using the
word new as an object key; expanded a complex object into multiple
arguments being passed through the event to make it easier to work
with and document
Change-Id: I8490815a508c6c379d5f9a743bb4aefd14576aa6
Right now this means things like headings and list items are rendered
nicer (without the whitespace), but also get their whitespace normalized
when saving back. I'll submit code tomorrow that preserves this
whitespace.
Submitting this now because it's needed to make <br>s look reasonable
Change-Id: I4b5e5ad8ee1bbe2f1eaf0fb860dd59f6e401dc3d
The new annotation API will do this too; this is a temporary hack to fix
the bugs caused by stripping attributes.
This code doesn't actually render the attributes, but the new annotation
API will.
Change-Id: Ic0ddf822fe02f101f2e825080c6bcc2a03115974
Stack traces, line numbers, etc. All the approaches I've seen are bad hacks. This is the best way to go.
Change-Id: Ib12e9d2ecfe610bcc89d046005e35cc13efa3d99
Throwing strings is bad because it doesn't include a lot of important
information that an error object does, such as a stack trace or where
the error was actually thrown from.
ve.Error inherits directly from Error. In the future we may create
more specific subclasses and/or do custom stuff.
Some interesting reading on the subject:
* http://www.devthought.com/2011/12/22/a-string-is-not-an-error/
Change-Id: Ib7c568a1dcb98abac44c6c146e84dde5315b2826
* Use 'href' of #ca-edit instead of constructing it manually.
MediaWiki's output of #ca-edit already takes care of all needed
queries, including "oldid" (bug 38125).
* Misc clean up:
- Use .get() instead of accessing the array directly.
* Clean up setupSkinTabs and add more inline documentation.
Change-Id: I7d702a3eb1f9ce23a5e3c9e846b00da5cead386e
* There were only 3 files with single quotes, fixed them all.
* Added option to .jshintrc (be sure to use the latest version of
node-jshint since this is a fairly new addition to the library).
Change-Id: I8bf8895ce56bf86e3bed244279a9d32269e44763
This just cleans up a few places where single quotes should have been used instead of double quotes.
Change-Id: I6c53652e71ab96842ed5bb41fb1e0b8c923eb25d
When closing annotation nodes, we weren't popping them off
annotationStack. Not sure where this came from, but the code was
definitely bad and this fixes it.
Change-Id: I6d805e9aca3778666212135f76ff34c6baacbbc8
* Default value of wgVisualEditorParsoidURL is broken.
Slash is needed, else Api will request to
http://hostnamePageName
Roan says double slashes are okay, and look cleaner than string
search checks etc.
* Use .clone() for mw.Uri instead of converting to string
and letting mw.Uri parse it, again. Clone creates a basic
instance and copies over properties internally (deep copy,
no references).
* No need for hasOwnProperty (and its potential issues)
* Code clean up
- Whitespace consistency
- Variable hosting
- Remove redundant `return false;` statements in event handlers
e.preventDefault() is a jQuery.Event method that takes care
of cross-browser issues.
- Same for e.keyCode||e.which thing, this is already normalized
by jQuery.Event
- Add missing parameter to setTimeout
- Consistent order in success/error handlers in $.ajax options
Change-Id: I5bc24e0cbdf01b3704d4ccb0b45b3052e3b58694
Also:
* Removed a lot of dead code in Surface that was used in the now dead and gone sandbox.
* Changed from throwing an exception when calling getBalancedData on a range that produces no results from selectNodes to just returning []
Change-Id: Icf27094724eae5b90eec21308f9e26afe877e3ee
When editor surface loses focus, now checking to see if an inspector
is set or a menu is open prior to closing the context.
This ruling ensures more rational context icon / child menu behavior.
Change-Id: Ic4b74bb51e811e264a2109a3c1c5a8ae503a8c49
* Moved all constants to a singleton constants object
* Moved couple methods to mediawiki.Util.js
* Fixed url regexp bug -- relative urls weren't being matched
but, this bug escaped through because the previous url regexp
had a typo (which means url sanitization wasn't being done by
the previous code). This also means we have to either find
sanitizer tests or add new ones so these bugs are caught. Maybe
parserTests.txt is not the right place for this?
Change-Id: Ia05e1d1596bb9bc4a9eb21d7c77248f5626a710e