Comments (3)
Yeah this is pretty weird.
Line 367 of tota11y.js sets update
to applyToTag
with its first argument already bound to styleElement
.
update = applyToTag.bind(null, styleElement);
However, we see that on line 373, the statement update(obj)
results in the second argument to applyToTag
being undefined (instead of obj
). This is what's causing the error (we try to access the css
property of the second argument).
So, why is this happening?
The "bind" I mentioned earlier is actually intercepted by mootools (you called it):
bind: function(bind, args){
var self = this;
if (args != null) args = Array.from(args);
return function(){
return self.apply(bind, args || arguments);
};
},
Quite curiously, the returned function will ||
the original arguments with whatever it's called with, instead of concatenating them.
But there's another bind
in this file!
bind: function(that){
var self = this,
args = arguments.length > 1 ? Array.slice(arguments, 1) : null,
F = function(){};
var bound = function(){
var context = that, length = arguments.length;
if (this instanceof bound){
F.prototype = self.prototype;
context = new F;
}
var result = (!args && !length)
? self.call(context)
: self.apply(context, args && length ? args.concat(Array.slice(arguments)) : args || arguments);
return context == that ? result : context;
};
return bound;
},
The latter should work just fine, but it's overwritten by the weird one mentioned above it.
I went ahead and made a JSBin to showcase this odd behavior: https://jsbin.com/jitixe/edit?html,js,console
You'll see that add3(7)
should result in 10, but the actual result is NaN for the reasons mentioned above.
If we instead include "MooTools 1.5.0 (without 1.2 compatibility layer)" like I have in this JSBin: https://jsbin.com/zakuf/edit?html,js,console, we get 10 as expected.
tl;dr: Looks like Webpack's style-loader won't work with MooTools's 1.2 compatibility layer.
No one has touched this file since August 2011, so we can't rely on a fix from them :) Is there any way you can use MooTools without this compatibility layer? Otherwise you'll need to host tota11y yourself and include it before mootools if possible.
I'm going to close this issue because it's not a bug in tota11y (or even webpack), but I'm happy to explore some options with you.
from tota11y.
I believe it is not getting along with MooTools.
from tota11y.
Hey @donatj,
I can confirm this is happening, and though minified it looks like some webpack code that manages dynamic stylesheets. I'll look into this further today with an unminified copy - thanks for reporting.
from tota11y.
Related Issues (20)
- Elements with aria-hidden="true" still included in output of Screen Reader Wand HOT 5
- Don't include build artifacts in repo HOT 1
- Add .editorconfig
- Merging in additional plugins
- Suggested Contrast Colors Appear to Have Rounding Errors HOT 2
- Headers order does not respect role heading
- Bad distribution system. HOT 6
- Link Text is Unclear HOT 1
- False Positive: Video element triggers label warning
- "First heading is not an <h1>" should not be an error
- False negative? Link with <code> inside
- (new user) tota11y doesn't work on all webpages HOT 1
- Which level is Tota11y checking against? HOT 1
- Stopped Working Entirely HOT 4
- Provide the ability to ignore/exclude custom elements
- 11y HOT 3
- Abandoned? HOT 5
- Injected style sheet CSS causing strange behavior
- differentiate green and red highlight
- khan.github.io/tota11y/ 404s HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tota11y.