Why does this plu­g­in fil­ter con­tent at page load? Wouldn’t it be more ef­fi­cient to do it when post is saved?

There are a few reasons:

  1. If I processed at the time of sav­ing a post, the changes are de­struc­tive. This means: 
    • If peo­ple to back to ed­it their work, there will be a mul­ti­tude of hid­den char­ac­ters that will in­ter­fere with their efforts
    • Spell check would be bro­ken (in browsers like Firefox)
    • If you dis­able the plu­g­in, the changes are still hard­cod­ed, and will not go away.
  2. Changes would on­ly ap­ply to posts saved af­ter the plu­g­in was en­abled (not on pre­vi­ous posts, since they have al­ready been saved, and thus would not trig­ger the ty­po­graph­ic filtering).
  3. Set­tings would not be editable-​since pre­vi­ous fil­ter­ing is stored in the data­base, if you turned off hy­phen­ation, that would on­ly ap­ply to new posts saved.
  4. For most in­stal­la­tions, caching re­solves per­for­mance issues.

But to be hon­est, the biggest rea­son is if there is a bug in my code, I don’t want to be re­spon­si­ble for de­stroy­ing da­ta in the thou­sands of web­sites that use this plu­g­in. If some­thing goes wrong, they can just turn it off — no dam­age done.


mnd.sc-Admin

More posts

| | Posted in | Comments Off on Why does this plu­g­in fil­ter con­tent at page load? Wouldn’t it be more ef­fi­cient to do it when post is saved?
Comments are disabled for this post.