freeCodeCamp icon indicating copy to clipboard operation
freeCodeCamp copied to clipboard

null is not an object (evaluating 'editor.match(/

Open opensourcekam opened this issue 11 years ago • 5 comments

Challenge http://www.freecodecamp.com/challenges/waypoint-override-class-declarations-with-inline-styles has an issue. Please describe how to reproduce it, and include links to screenshots if possible.

Getting an issue if you only have style="" typed into the editor once you add the style the error disappears.

opensourcekam avatar Aug 18 '15 18:08 opensourcekam

Hey @RobinsonKameron I was able to replicate but I'm not really sure what we can do about this....

I'll keep this open for now.

benschenker avatar Aug 26 '15 23:08 benschenker

When i used style="color : white" (space on either side of colon), i got the editor.match(...) error. I removed the spaces to look like this style:"color:white" (without spaces) and the error disappeared. Hope this helps.

kishoresmeda avatar Sep 04 '15 03:09 kishoresmeda

I believe that the issue is that the space before the colon is making the test fail.

benschenker avatar Sep 04 '15 03:09 benschenker

@benschenker you are right. There are many challenges where camper fails to pass the test because of a space. or a new line character. To avoid issues like this we need to go through all challenges and extend tests so they'll actually allow any whitespaces which is a hard work. This work actually had to be done by the creator of this challenges. Also: 'null is not an object' error is caused by editor.match(/<h1.*style.*color:/gi).length > 0 parameter. If you remove length > 0 the object will be still null (I think so) but this error won't show up.

bugron avatar Sep 04 '15 12:09 bugron

@TiffanyECook this seems to be a separate issue. Feel free to open a new issue about this.

benschenker avatar Sep 10 '15 21:09 benschenker