Make WordPress Core

Changes between Version 2 and Version 3 of Ticket #21547, comment 2


Ignore:
Timestamp:
08/11/2012 07:28:08 AM (12 years ago)
Author:
gkb6891
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #21547, comment 2

    v2 v3  
    88Here's the specific scenario: we run multiple a/b tests each of which needs some dynamic parameters passed to a static javascript file. Each of these a/b tests enqueues the static javascript file if it's not already been enqueued.
    99
    10 The current implementation of wp_localize_script simply creates a new JS object each time it's called. A developer (like me in this case) might want to modify the existing JS object instead of creating a new one. It's easy to simply delocalize the script by passing the handle and calling wp_localize_script one more time.
     10The current implementation of wp_localize_script simply creates a new JS object each time it's called. This often leads to duplicate objects or overwriting existing objects. A developer (like me in this case) might want to modify the existing JS object instead of creating a new one. It's easy to simply delocalize the script by passing the handle and calling wp_localize_script one more time.