nions are a huge magnet for bacteria, especially uncooked onions. You should never plan to keep a portion of a sliced onion.. it's not even safe if you put it in a zip-lock bag and put it in your refrigerator.
Read this post on keepwrite.com