Yoast / wordpress-seo

Yoast SEO for WordPress
https://yoast.com/wordpress/plugins/seo/
Other
1.76k stars 886 forks source link

JavaScript - Uncaught Error: Unable to Tokenize (in: wp-seo-post-scraper-410.min.js?ver=4.1:6) #6558

Closed eighty20results closed 7 years ago

eighty20results commented 7 years ago

What did you expect to happen?

Readability score doesn't update and the readability tab doesn't work

What happened instead?

Error message in JS console (Chrome):

Uncaught Error: unable to tokenize at Object.end (wp-seo-post-scraper-410.min.js?ver=4.1:6) at j (wp-seo-post-scraper-410.min.js?ver=4.1:16) at p (wp-seo-post-scraper-410.min.js?ver=4.1:16) at c (wp-seo-post-scraper-410.min.js?ver=4.1:6) at d (wp-seo-post-scraper-410.min.js?ver=4.1:4) at d (wp-seo-post-scraper-410.min.js?ver=4.1:6) at d (wp-seo-post-scraper-410.min.js?ver=4.1:5) at b.exports (wp-seo-post-scraper-410.min.js?ver=4.1:16) at d (wp-seo-post-scraper-410.min.js?ver=4.1:16) at o (wp-seo-post-scraper-410.min.js?ver=4.1:16)

How can we reproduce this behavior?

For me it's a matter of loading the Post editor & the error happens

Can you provide a link to a page which shows this issue?

It's on the post edit page of my site so not readily, sorry.

Technical info

terw-dan commented 7 years ago

This seems to be related to https://github.com/Yoast/YoastSEO.js/issues/840. Can you post a sample text where you have this issue?

eighty20results commented 7 years ago

Post source included below (This started happening the day before I reported it, so I have two posts where it's going on. They're edited/managed via the Post Editor in WP backend.

`

Lifestyle skills, a part of life that "should" come naturally?

The lifestyle skills focus for today; "Getting fit under real-life conditions". We are alive and living, so we do have some skill at not dying. The skills I am referring to are the ones that make our lives a bit better, and definitely more healthy.

Instead of viewing the acts of eating well and exercising as; "What you do when you have time for it, but life is too busy right now", consider viewing it the same as raising kids, caring for animals, or your "means to a lifestyle" (work). You cannot ignore those things without real and big life-changing consequences.

Guess what... Stop eating well and exercising, and you will also eventually see real life changing consequences.

We do our best with all the other responsibilities in life, so why not do the same with fitness and eating well?

It May Be Ugly, But It is Fantastic, Because It Is Done

Something is better than nothing. You want to keep going no matter what it looks like.

If you roll out of bed and do a quick down-and-dirty "wake me up" workout, it is something.

Going through a short phase of your life like this may not make you the fittest you have ever been, but it will keep you going. It is way better than doing nothing. Instead of the "all or nothing" mentality, how about just shooting for "something"?

One way to work on this lifestyle skill of doing something instead of nothing is simply planning your next day, or if you're ambitious, your week ahead.

Say you know that you know your next day will be crazy, maybe shooting for a good night sleep and a quick workout next to your bed is the best you can do. And it's actually quite great, compared to most westerners.

You also know that in the middle of the week, things ease up on your schedule and you will be able to get to the gym. What will you do then?

Another way of looking at it is this; If your plate is full with helping out your parents while they move, working on an exciting project at work, looking for a house to buy, and a pending doctors visit. Adapt. You can plan for the next 3 months by deciding to train 3 times a week for between 10-20 minutes. You have everything at home, and whatever you need is easy to take with you. Basically, you know you can get it done first.

What a load off knowing that one thing that will be happening regularly for the next 3 months. You are in control of how much time you spend with each workout. Now those are some lifestyle skills!

Magic Source

This article was inspired by a post by John Berardi, Ph. D. co-founder of Precision Nutrition. He has some other great insights and suggestions if you want to check it out, click here.

Don't stop, never stop, just adapt. Have a great workout today, and give yourself a hug for being awesome!!

[daily_progress type="assignment"]

  `

terw-dan commented 7 years ago

If you remove the last shortcode [daily_progress type="assignment"] do you have the same error?

Do you have a link to this post where we can view the source?

eighty20results commented 7 years ago

It seems to be related to the shortcode, but I'm unclear on why it can't be tokenized?

The post is behind a paywall and I can't open it for general access.

terw-dan commented 7 years ago

Can you copy/paste the code that the shortcode is generating?

The easiest way to do this is to create a post, containing only the shortcode and then running YoastSEO.app.paper.getText() from the JavaScript Console. If you can paste the outcome here, I'll have a look at it to see what could be causing the problem.

eighty20results commented 7 years ago

`


Your Daily Assignment


`

eighty20results commented 7 years ago

It looks like the nested <p></p> elements is at the root of this, but I don't know where the initial <p></p> comes from since the code itself uses <div>s with the exception of the "You have completed this preview" text which is intentionally wrapped in a paragraph.

terw-dan commented 7 years ago

This seems to be caused by this part <button id="e20r-lesson-complete" class="e20r-button assignment-btn">I have read this</button> Including the whitespace.

Since this is something we need to fix in YoastSEO.js I'm closing this issue in favor of https://github.com/Yoast/YoastSEO.js/issues/840